274 views
in Embedded Wizard Studio by
Can i change number to string with comma

Ex 1000 -> "1,000"

1 Answer

0 votes
by

Hello,

you can modify the resulting string and e.g. insert comma signs. The following code demonstrates how to add thousands separatos to a string containing a formatted integer number:

var int32  number = 1234567890;
var string str    = string( number );
var int32  len    = str.length;

for ( ; len > 3; len = len - 3 )
  str = str.insert( ',', len - 3 );

trace str;

At the runtime the code produces following outputs in the Log window:

Does it help you?

Best regards

Paul Banach

Embedded Wizard Website | Privacy Policy | Imprint

...