[code] dim sx,sx1,sx2 as Double
dim a,b,c as string
sx=1500000
sx1=-200000
sx2=20000
a=format(sx, “###,##0”)
b=format(sx1, “-###,##0”)
c=format(sx2, “###,##0”)
This is the problem, I cant change the locale setting in windows control panel, because there is already an app in my pc that not allowing me to change it, otherwise it wont work.
[quote=393446:@Loannis Kolliageorgas]This code working fine for me
[code]Dim locale As New Xojo.Core.Locale(“en-US”)
Dim n As Double = 12394567
Dim t As Text = n.ToText(Locale.Current, “#.###.###”)
MsgBox str(t)[/code]
Results = 12.394.567
I forget to put this…
Dim locale As New Xojo.Core.Locale("el-GR")
Dim decimal As Text
decimal = locale.DecimalSeparator
Msgbox decimal
Results ([b],[/b])
Dim locale As New Xojo.Core.Locale("en-US")
Dim decimal As Text
decimal = locale.DecimalSeparator
Msgbox decimal
Results ([b].[/b])[/code][/quote]
The mac api being used by the framwork is different to the windows api, the mac api allows the use of . as a group separator but it doesnt work on windows which is where the error came from above that Arief reported in an earlier post.
The above code is only working because your locale has a . for its group separator as the code isn't actually using the one defined in that code snippet.
You'll need the following to work across all platforms:
[code]Dim l As New Xojo.Core.Locale("es")
Dim n As Double = 12394567
Dim t As Text = n.ToText(l, "#,###") // add .### onto the end if you want to deal with decimals which will be separated with ,
MsgBox(t)
As Spain uses a . for its group separator it should work for you, tested ok on windows and mac.
Technically you don’t even need to specify the formatting in the above example as Spain uses the format you want, you could just use this in the above code instead: