n is already a double.
I am printing the string (using “g.DrawString(s,x,y)”, not putting it in a TextField.
Your second example uses the continental system - comma for the decimal, full stop for thousands - which I don’t want.
Seems to me, with FORMAT you MUST use “comma” for thousands, and “period” for decimal, and FORMAT will alter it internally based on the users locale settings.
And Drawstring or putting in a textfield, the manner in which you use FORMAT is still the same
ToText will, or can be, set up to make strings look “proper” for the users current locale settings.
So you’d get the euro symbol in countries where they use that, commands for decimal separators where they use that etc.
It’s intended to be for display purposes.
Now when you know you want to display a number in a specific format (say whats correct for France) then you can specify a specific locale and the formatting rules for that locale will be applied.
The ONLY place where this doesn’t work quite the way you might hope is on the web because the app runs ON THE SERVER not on the persons computer - so you get the formatting that is appropriate for the SERVER and its locale.
That is one place where you pretty much vae to track the users locale in the session and then use a specific locale.
So something like
dim n as double = 33883.67
// format things for whatever the CURRENT locale is
dim t as text = n.ToText( xojo.core.Locale.current, "¤###,###,###.00;-¤###,###,###.00")
msgbox t
// format things for french in France
t = n.ToText( New Xojo.Core.Locale("fr-FR"), "¤###,###,###.00;-¤###,###,###.00")
msgbox t