Re: How best to extract digits from a string?
Re: How best to extract digits from a string?
- Subject: Re: How best to extract digits from a string?
- From: "Arthur J Knapp" <email@hidden>
- Date: Sat, 28 Apr 2001 19:26:16 -0400
>
Date: Sat, 28 Apr 2001 09:51:00 -0700
>
Subject: Re: How best to extract digits from a string?
>
From: Paul Berkowitz <email@hidden>
>
On 4/28/01 9:27 AM, "Arthur J Knapp" <email@hidden> wrote:
>
> In the very specific case where the input is a phone number, (ie:
>
> "(800) 555-1212", a string of numbers, hyphens, and parentheses),
>
Not if you're "internationally" oriented. ...
Right, sorry. I meant simply to say that for a *string* with only
numbers, hyphens, and parentheses, that the "usually" broken word
reference can be used to remove the non-numbers. I did not mean to
suggest that this was a "proper" phone number.
>
So:
>
>
set input to "+44 207 624 2060"
>
set phWds to every word of input
>
repeat while item 1 of phWds = "+"
>
set phWds to rest of phWds
>
end repeat
>
set output to "" & phWds
>
>
-- > "442076242060"
>
>
That should still be pretty fast.
And indeed it is... :)
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://www.eremita.demon.co.uk/scripting/applescript/