lua-users home
lua-l archive

Re: breaking down stream

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


I would use a table for breaking down the phone number

phoneTable = {
1 = "<regular _expression_ for country code 1>",
852 = "<regula _expression_ for country code 852>"
}

phoneNumber = "<phone number>"
for k,v in pairs(phoneTable) do
s,e = string.find(phoneNumber,"^" .. tostring(k))
if s then
s,e,phones = string.find(phoneNumber,v)
< do any process you want >
end
end


AltStyle によって変換されたページ (->オリジナル) /