Possible loss of precision; extracting char from string
Posted
by Troy
on Stack Overflow
See other posts from Stack Overflow
or by Troy
Published on 2010-03-09T03:00:38Z
Indexed on
2010/03/09
3:06 UTC
Read the original article
Hit count: 328
I am getting a string from the user and then doing some checking to make sure it is valid, here is the code I have been using;
char digit= userInput.charAt(0) - '0';
This had been working fine until I did some work on another method, I went to compile and have been receiving a 'possible loss of precision' error since then.
What am I doing wrong?
© Stack Overflow or respective owner