Hi! I have small problem and question. How to get string in style: 123,456,789 from int: 123456789?
ps. Sorry for mistakes
Variable1=123456789
set Text............................ left(str(Variable1),3)&","&mid(str(Variable1),3,3)&","&right(str(Variable1),3)
Thanks
Works for me:
left(str(var0),1) & "," & mid(str(var0),2,3) & "," & mid(str(var0),5,3) & "," & mid(str(var0),7,3)[/code:25jj0mhl]
Develop games in your browser. Powerful, performant & highly capable.
I wouldn't recommend that solution, as it only works for numbers with a fixed number of digits. I'd suggest using RegexReplace instead, demonstrated by the following expression:
RegexReplace(str(MyNumber), "\B(?=(\d{3})+(?!\d))", "g", ",")[/code:m8pi3te3] Regular expression comes from a [url=http://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript]similar question[/url] on StackOverflow.