lua-users home
lua-l archive

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


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"

Something like (also untested):
country,area,localnum=string.match(x, '(%d)(%d%d%d)(%d%d%d%d%d%d%d)')

 - Jeff