Are you using a system that is set to use UK English? That is how they do decimals over there. As the link you have mentioned points out, you can correct this by tacking on: .replace(',', '.').replace(' ', ',');
@TfGuy44 It is common for commas and decimals to be switched in many European countries or to have spaces instead of commas (in comparison with english-speaking countries).
Some forum members suspect that this relates to the language / region settings of your machine. Can you share something about whether your computer keyboard, OS, or user profile are configured to a particular country or language? The more information we have the more likely it is that someone can suggest a workaround or that fixes can eventually be incorporated.
You may wish to search for an existing issue here:
import java.util.Locale;
float f = 1.23;
String s = nf(f, 0, 1);
println(s); // Prints "1,2"
println(Locale.getDefault().getLanguage());
println(Locale.getDefault().getCountry());
Also, find where the preferences file is (it’s location is at the bottom of the preferences window at File | Preferences. Edit this file when Processing is not running and try changing the run.options line to
Did you really get the output en / US before making the change?! That’s really strange if so.
What I suggested is just a workaround to force the locale settings - I’d report a bug on this, although whether the documentation or code should be updated is another question.
I’m not sure how much the Windows settings affect the JDK Locale configuration. However, I’m really surprised that setting the locale language and country to what they claim to be before changes anything! I was expecting the output to be something else.
OK, that makes more sense. So your system is somehow registering that it should use Hungarian for formatting things like numbers, dates, etc. That might be related to a setting in Windows somewhere, but I’ve no idea where! Or why they’re different.
It might be worth opening a GitHub issue on this. Firstly to work out whether the docs are wrong or not - is the intention to use the locale settings for format. And, secondly, to document where those settings are read from / whether Processing should use something other than the default mechanism for finding them. Seems all related to changes in https://docs.oracle.com/javase/8/docs/technotes/guides/intl/enhancements.8.html