Universal Robots Forum

French float error in urcap Numeric Input

Hello, just saw a little bug, that could be impacting every french urcap users:

French people use the comma (,) to separate the unit from decimal, instead of the point.
The numeric textinput (only in urcaps) show us the point. but when we validate, it is converting it by default in a comma, and it’s making the function ParseFloat buggy.

Of course I can deal with it by myself on my urcap, but this bug will probably affect every urcap ( because I highly doubt that english developpers will test their products on french language )

Thank you, @mdi
This has been reported.

1 Like

I had the same problem with the german numbers. I fixed it by parsing with the NumberFormat Class like this:


This respects the number format of the current locale.

Hope this works for you.

As @schill suggest, I would recommend using:

String textWithNumFormat = NumberFormat.getInstance().parse(textInField).toString();

This results in a text string with the value and dot-notation, if e.g. float is desired, you could use:

float myFloatVal =  NumberFormat.getInstance().parse(textInField).floatValue();

As I said, I can handle it the way I want in my URcaps, but english developpers won’t think of doing this, because they don’t even know that we’re using comma instead of points.
So every or their urcap won’t work on these languages.