[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: breaking down stream
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 12 May 2008 23:39:31 -0300
> 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