API:MoneyNormalization

function MoneyNormalization(money) if ( not money ) then return ""; end -- 金錢等於零或分隔字元不存在 local comma = getglobal("COMMA"); if ( not comma or money == 0 ) then return money; end local value = tonumber(money); local text = ""; local quotient, remainder; while (value > 0) do		quotient = math.floor(value / 1000); remainder = math.mod(value, 1000); if ( quotient > 0 ) then remainder = string.format("%03d", remainder); end

if ( text == "" ) then text = remainder; else text = remainder..comma..text; end value = quotient; end return text; end