Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Newbie help: Parsing mobile email address

From: petr:krenzelok:trz:cz at: 11-Jun-2002 8:09

Matthew Kim wrote:
>Hi, > >I've managed a crude way to parse a mobile email address down to its >phone number (area code, and 7 digit number) using a loop and if >statements. However, I'm wondering if there's a more efficient way to do >it (shortcuts in REBOL) > >Basically I'm trying to do this... > >Mobile Email Address: [4165551234--pcs--rogers--com] > ><Parsing algorithm> > >Result: >~~~~~~~~~~~~~~~~~~~~~~~ >Area Code: 416 >Phone Number: 5551234 >
->> Address: [4165551234--pcs--rogers--com] == [4165551234--pcs--rogers--com] ->> digit: charset [#"0" - #"9"] == make bitset! #{ 000000000000FF03000000000000000000000000000000000000000000000000 } ->> parse to-string address [copy phone some digit "@" copy domain to end] == true ->> print phone 4165551234 ->> print domain pcs.rogers.com Parse is fun .... mostly ;-) Cheers, -pekr-