Difference between revisions of "Module:IsLatin"

From Northumberland Climbing
Jump to navigation Jump to search
newcastle>Traveler100
m (Protected "Module:IsLatin": used in all listings on all pages ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
 
m (1 revision imported)
 
(No difference)

Latest revision as of 06:17, 2 August 2020

Documentation for this module may be created at Module:IsLatin/doc

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 "yes";
end

return i;