Format Number
Format a number with commas, making it more readable. Also accepts decimals.
This snippet does not require an addon to function.
Code
function formatNumber(x: num) :: string:
set {_x::*} to split "%{_x}%" at "."
set {_x::1} to join (regex split {_x::1} at "(?<=\d)(?=(\d\d\d)+(?!\d))") by ","
return join {_x::*} by "."
Usage
broadcast formatNumber(10000000.389)
# output: 10,000,000.39
Last updated
Was this helpful?