Getting/changing the decimal symbol?
I have a string containing a decimal number. But if I convert it to a float or double, the decimal symbol will either be be ignored or the method throw a NumberFormatException (I'm not sure which one) if the program is run on a machine with a different decimal symbol specified in the settings than what is used in the string, right?
So, I thought I could either detect what decimal symbol the system uses and replace the one in the string with that, or for that internally change the setting itself, using the System.getProperty(String), which I had previously used for things like the new line character(s) and path separator. There doesn't seem to be a property for the decimal symbol though.
I'm guessing there is a way to do this(because internationalization is important for most anything related to computers), but... how? I don't want to seem like the guy who just jumps in and demands someone else to write the code for him, but I have no idea how to do this.
Re: Getting/changing the decimal symbol?
If you have done simple wrapper conversion with the dot symbol as the decimal point it returns the same regardless of the decimal symbol you have set in the system.
However, there are ways to we can consider the localizations.
String strVal = "12.23";