• 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: Richard 23 <email@hidden>
  • Date: Thu, 26 Apr 2001 04:59:26 -0700

>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?

I can't think of one although I'd change the repeat statement to

repeat with char in input

R23


  • Follow-Ups:
    • Re: How best to extract digits from a string?
      • From: Bill Cheeseman <email@hidden>
  • Prev by Date: upload via ftp
  • Next by Date: Re: Screen Blanking-duh...
  • 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