Decimal separator

Justin Whear justin at economicmodeling.com
Fri Feb 12 10:54:59 PST 2010


nrgyzer Wrote:

> Hello everyone,
> 
> I'm trying to split an integer into a integer with decimal points (or char[] with decimal points). I already know that I can do this with std.format.doFormat() but I don't know how I can use this to convert my int (for example... 10000) to 10,000.

Well, integers don't have anything following the decimal, so there's nothing to do really. Unless you want to convert the integer to a string and append ".00" or something. Perhaps you want to convert the integer to a string and insert thousands separators? If so, you'll want to loop from the end of the string towards the beginning, inserting a comma every 3 characters.




More information about the Digitalmars-d mailing list