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: Thu, 26 Apr 2001 16:51:00 -0400
>
Date: Thu, 26 Apr 2001 09:36:25 -0700
>
Subject: Re: How best to extract digits from a string?
>
From: Jed Verity <email@hidden>
>
After running some simple benchmark tests, I found the concatenation method
>
to be dramatically faster for strings. For example:
>
>
--Concat Test:
>
set str to ""
>
repeat 5000 times
>
set str to str & "a"
>
end
>
>
--List Test
>
set str to {}
>
repeat 5000 times
>
set end of str to "a"
You're not going to believe this, but a very simple change
to the above will equalize List Test and Concat Test.
>
end
>
set applescript's text item delimiters to ""
>
str as string
-- Variable Test
set str to {}
set aVar to "a" -- save literal to variable
repeat 5000 times
set end of str to aVar -- don't use literal
end repeat
str as string
-- Reference Test
set str to {}
set rstr to a reference to str
repeat 5000 times
set end of rstr to "a"
end repeat
str as string
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
<
http://developer.apple.com/techpubs/macos8/InterproCom/AppleScriptScripters
/AppleScriptLangGuide/>