Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Setting decimal point for formatting floats.

$
0
0
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.

Viewing all articles
Browse latest Browse all 1768

Trending Articles