• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting Value of String  RSS feed

 
Steve Dyke
Ranch Hand
Posts: 1785
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I use the sting 56230 thi code wors fine however if I try ABCD I get the error below.




Error:
java.lang.NumberFormatException: For input string: "A"
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are using Integer.valueOf(decriptedletter) to create an Integer object from a String. This method expects a string that contains only digits. "A" is not a digit, it cannot be converted to an integer - so you get a NumberFormatException.

Did you see my answer in your other thread?

Are you trying to get the ASCII value of the character "A"? The code above does not do what you think it should do.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!