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: Bill Cheeseman <email@hidden>
- Date: Fri, 27 Apr 2001 18:30:30 -0400
on 4/27/01 4:40 PM, Richard 23 at email@hidden wrote:
>
I would guess that concatenating strings would be faster since there's no
>
overhead as far as list/vector structures are concerned.
Well, string operations still have to work as arrays/lists/vectors/something
under the hood. But that's what I've found today, trying to better the
efficiency of my original technique (with your enhancement) for extracting
digits from a string. In my testing, concatenating strings remains a little
less than 5% faster than Paul Berkowitz's technique using the "end of"
syntax on a list. I haven't been able to find anything faster, at least for
short input strings like phone numbers.
I even tried a couple of tricks based on foreknowledge that the output
string for an area code and telephone number has to be 10 characters long,
but I couldn't find anything faster.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
The AppleScript Sourcebook - www.AppleScriptSourcebook.com
Vermont Recipes - www.stepwise.com/Articles/VermontRecipes