Module:Ordnance Survey coordinates/sandbox: Difference between revisions

Content deleted Content added
better error handling
even stricter
Line 272:
local function NGR2LL(ngr)
-- returns a country,error,lat,long list
ngr = mw.ustring.gsub(mw.ustring.upper(ngr),"[^%ds%up]","")
local first, last, lett, num = mw.ustring.find(ngr,"^(%u[A-Z]+)(%d+)$")
if first == nil or empty(lett) or empty(num) or mw.ustring.len(lett) > 2 then
return nil,"Malformed NGR",0.0,0.0