Good afternoon,
One question, with Corona is it possible to make the separation of thousands with the numbers? that is, I do not get $ 123456 but $ 123,456
Good afternoon,
One question, with Corona is it possible to make the separation of thousands with the numbers? that is, I do not get $ 123456 but $ 123,456
comma_value:
https://roaminggamer.github.io/RGDocs/pages/SSK2/extensions/#string
https://github.com/roaminggamer/SSK2/raw/master/ssk2.zip
or just use the code directly:
-- == -- comma\_value(val, n) - Converts a number to a comma separated string. (http://lua-users.org/wiki/FormattingNumbers) -- val - The value to convert to comma separated string. -- == function string.comma\_value(amount) local formatted = amount while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if (k==0) then break end end return formatted end
print("$" .. string.comma\_value(1234567))
prints
$1,234,567
comma_value:
https://roaminggamer.github.io/RGDocs/pages/SSK2/extensions/#string
https://github.com/roaminggamer/SSK2/raw/master/ssk2.zip
or just use the code directly:
-- == -- comma\_value(val, n) - Converts a number to a comma separated string. (http://lua-users.org/wiki/FormattingNumbers) -- val - The value to convert to comma separated string. -- == function string.comma\_value(amount) local formatted = amount while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if (k==0) then break end end return formatted end
print("$" .. string.comma\_value(1234567))
prints
$1,234,567