• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NumberFormatException using line.substring

 
Tim Hollis
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to check if a particular point in a sting "line" has any value in it or not. I know that the string will be composed of numbers, so
I have tried using :

I know that this is an awkward way of doing this, and it doesn't work! If the string is empty by the time I get to this point, I get a NumberformatException error.
Can anyone suggest a way I can check if a substing is not null? This HAS GOT to be simple!?!
 
Gyula Klinszky
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try checking the length of said string !
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should break each function call into its own line. This would help simplify things drastically.
HTH
Layne
 
William Barnes
Ranch Hand
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya, what Layne said.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic