יחידה:אות למספר
קפיצה לניווט
קפיצה לחיפוש
ניתן ליצור תיעוד על היחידה הזאת בדף יחידה:אות למספר/תיעוד
local p = {}
function p.fromHebrew(frame)
local input = frame.args[1]
if not input then
return ''
end
local hebrew_letters = {
['א'] = 1, ['ב'] = 2, ['ג'] = 3, ['ד'] = 4, ['ה'] = 5, ['ו'] = 6, ['ז'] = 7, ['ח'] = 8, ['ט'] = 9,
['י'] = 10, ['כ'] = 20, ['ל'] = 30, ['מ'] = 40, ['נ'] = 50, ['ס'] = 60, ['ע'] = 70, ['פ'] = 80, ['צ'] = 90,
['ק'] = 100, ['ר'] = 200, ['ש'] = 300, ['ת'] = 400, ['ך'] = 20, ['ם'] = 40, ['ן'] = 50, ['ף'] = 80, ['ץ'] = 90
}
local number = 0
for i = 1, mw.ustring.len(input) do
local char = mw.ustring.sub(input, i, i)
if hebrew_letters[char] then
if i == 1 and mw.ustring.sub(input, 2, 2) == "'" and mw.ustring.len(input) > 3 then
number = number + hebrew_letters[char] * 1000
else
number = number + hebrew_letters[char]
end
end
end
return number
end
return p