• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How best to extract digits from a string?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How best to extract digits from a string?


  • Subject: Re: How best to extract digits from a string?
  • From: Harald E Brandt <email@hidden>
  • Date: Thu, 26 Apr 2001 23:10:00 +0200

+--> Bill Cheeseman wrote 01-04-25:
>So now I filter for numerical digits as in this example:
>
>set digits to "1234567890"
>set input to "(800) 555-1212"
>set output to "" -- initialize
>repeat with char in every character of input
> if char is in digits then set output to output & char
>end repeat
>get output --> "8005551212"
>
>Is there a more efficient way to do this?
+--

This avoids the slow loop, is really fast,
but requires the osax RegEx Commands:

REReplace "++(800) 555-1212 - Mr. Jones" pattern "[^0-9]" with ""
--> "8005551212"
(The character after the first square bracket should be a 'hat')



______heb________________________________________________________________
Harald E Brandt email@hidden PGP/MIME aware http://heb.surf.to


References: 
 >How best to extract digits from a string? (From: Bill Cheeseman <email@hidden>)

  • Prev by Date: Re: How best to extract digits from a string?
  • Next by Date: Re: Non-modal information window showing progress?
  • Previous by thread: Re: How best to extract digits from a string?
  • Next by thread: Re: How best to extract digits from a string?
  • Index(es):
    • Date
    • Thread