Hi all,
imagine you have some type of client (Swing,
JSP, CommandLine) that reads
a number value (e.g. 1.234) from the keyboard. "1.234" is represented as a
String.
Now, having an international application, in the US the user may enter 1.234
whereas in Europe the user may enter 1,234
How can I make sure that my code can work with both formats equally?
I know there is such thing as Locales but how would I apply them in my case?
Further, how can I guaranty that the user won't enter something like 1.2funny34 or 1,2funny34 ?
I know I will get a NumberFormatException if I try to convert the String to
a double or something else but I still have the problem with "." and ",".
Any smart ideas?