Modulo:IsLatin

Da Wikivoyage.
Jump to navigation Jump to search

Esempi di utilizzo[modifica]

Testo Codice Risultato
Sport {{#invoke:IsLatin|IsLatin|Sport}}
Ştefăneşti {{#invoke:IsLatin|IsLatin|Ştefăneşti}}
大谷川ユースホステル {{#invoke:IsLatin|IsLatin|大谷川ユースホステル}} no
55 EUR {{#invoke:IsLatin|IsLatin|55 EUR}}
£55 {{#invoke:IsLatin|IsLatin|£55}}
55$ {{#invoke:IsLatin|IsLatin|55$}}

local i = {}
 
function i.IsLatin(frame)
    local txt = frame.args[1];
    if txt == '' then
        return '';
    end
    
    local len = mw.ustring.len(txt);
    local pos = 1;
    while ( pos <= len ) do
        charval = mw.ustring.codepoint(mw.ustring.sub(txt, pos))
        -- note 8364 is the € symbol
        if charval>687 and charval~=8364 then
            return "no";
        end 
        pos = pos + 1;
    end
    return "sì";
end

return i;