[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: breaking down stream
 
- From: KHMan <keinhong@...>
 
- Date: Tue, 13 May 2008 10:47:02 +0800
 
Jeff Pohlmeyer wrote:
> KHMan  wrote:
> 
>> Pete Kay wrote:
> 
>>> For instance, 16502839332 -> 1      650    2839332
> 
>> For a line like the above, you can use something like (untested):
>> ... string.match(x, "^(%d+)%s+%->%s+(%d+)%s+(%d+)%s+(%d+)$")
> 
> 
> I think he means, take the string "16502839332" and
> split it into the fields  "1" "650" "2839332"
My bad. Luiz's solution is more appropriate for the many country case.
> Something like (also untested):
> country,area,localnum=string.match(x, '(%d)(%d%d%d)(%d%d%d%d%d%d%d)')
-- 
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia