Setting decimal point for formatting floats.
in
Share your Work
•
4 months ago
In Processing 1.5 I used
Locale.setDefault(Locale.US);
in the setup() to make nf() produce decimal points for floats. If I did not, it would use decimal comma, as my window-pc is localized for Denmark. I need the decimal point as I am generating files, to be read by other programs.
In Processing 2.0 the line failed with that it can not find the routine/constant - until I include
import java.util.Locale;
The reference notes that nfc() is locale sensitive - but no clue how to override. It fails to note the locale sensitivity for the nf(), nfp(), and nfs() routines. (Those are the ones I have discovered, there is probably the same for input formatting of strings. The print() is not affected by locale - it is hardwaired to US/English it seems.
There are no hits on Locale or similar in Processing, its wiki or otherwise.
Locale.setDefault(Locale.US);
in the setup() to make nf() produce decimal points for floats. If I did not, it would use decimal comma, as my window-pc is localized for Denmark. I need the decimal point as I am generating files, to be read by other programs.
In Processing 2.0 the line failed with that it can not find the routine/constant - until I include
import java.util.Locale;
The reference notes that nfc() is locale sensitive - but no clue how to override. It fails to note the locale sensitivity for the nf(), nfp(), and nfs() routines. (Those are the ones I have discovered, there is probably the same for input formatting of strings. The print() is not affected by locale - it is hardwaired to US/English it seems.
There are no hits on Locale or similar in Processing, its wiki or otherwise.