Look here (I am using Polish locale):
var d as double = -12666333
var s as String
s=Format(d,"-###,###,###,###.00")
MessageBox s
This will display “-12 666 333,00” which is correct since the value is below zero.
If you forget “-” in Format format string:
var d as double = -12666333
var s as String
s=Format(d,"###,###,###,###.00")
MessageBox s
…i will display “12 666 333,00” which is not correct since “-” character was omitted.
But if you use .ToString with format, the “-” is not needed to display negative numbers correctly:
var d as double = -12666333
var s as String
s=ToString(Locale.Current,"###,###,###,###.00")
MessageBox s
You will get correct “-12 666 333,00”.
The behaviour of using “-” in Format command was explained in Xojo documentation and it behaves exactly as described, i.e. you need to put that “-” in front of format string to get negative values displayed correctly.
In case of .ToString the documentation points to Unicode Number Format Patterns where it seems the need of placing “-” character stays the same:
"minusSign
- Symbol used to denote negative value."
So, is Xojo correct or not?
I spotted this when my program starts to display i.e. “--12 666 333,00
” instead of “-12 666 333,00
” when using .ToString…