Module:ConvertNumbers
Documentation for this module may be created at Module:ConvertNumbers/doc
local p = {}
local khmerDigits = {'០', '១', '២', '៣', '៤', '៥', '៦', '៧', '៨', '៩'}
function p.toKhmer(frame)
local input = frame.args[1] or ""
local result = ""
for i = 1, #input do
local digit = string.sub(input, i, i)
local khmerDigit = khmerDigits[tonumber(digit) + 1]
if khmerDigit then
result = result .. khmerDigit
else
result = result .. digit
end
end
return result
end
return p