If input is a string “783” and I keep getting chars out of the string via input.charAt(i), is the only way to get the equivalent integer Character.digit(input.charAt(i),10) ??
Is there a simpler expression ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That’s the safest way to do it, but you can also simply subtract 48 from the character value, because 0-9 are 48-57 in unicode decimal values.
This will of course return unrealistic results if the character is something other than a digit however (for example
'A' - 48is17).