• Money Int
    4 replies, posted
Hello, I was wondering how to turn an int, Ex. 14123456 into money format (adding commas) Ex. 14,123,456 Thanks for any help!
[lua]function toMoney(m) m = tostring(m) for i = #m - 3, 1, -3 do m = string.sub(m, 0, i) .. "," .. string.sub(m, i + 1) end return m end[/lua] Quick and dirty.
[QUOTE=V34;28507274][lua]function toMoney(m) m = tostring(m) for i = #m - 3, 1, -3 do m = string.sub(m, 0, i) .. "," .. string.sub(m, i + 1) end return m end[/lua] Quick and dirty.[/QUOTE] Thank you, works like a charm :D!
[QUOTE=V34;28507274]Quick and dirty.[/QUOTE] sounds sexy
[QUOTE=notC-UNIT;28510159]sounds sexy[/QUOTE] [URL]http://en.wikipedia.org/wiki/Quick-and-dirty[/URL] But yes it's kind of sexy.
Sorry, you need to Log In to post a reply to this thread.