lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> I think he means, take the string "16502839332" and
> split it into the fields  "1" "650" "2839332"
> 
> Something like (also untested):
> country,area,localnum=string.match(x, '(%d)(%d%d%d)(%d%d%d%d%d%d%d)')

But only country "1" has 1 digit...

I think the solution is something like

for c,a in ipairs(country) do
	if string.match(s,"^"..c) then
		for aa in ipairs(a) do
			local n=string.match(s,"^"..c..aa.."(%d+)$")
			if n ~= nil then found(n) break ebd
		end
	end
end