Re: String to multiple-item list coercion
Re: String to multiple-item list coercion
- Subject: Re: String to multiple-item list coercion
- From: Steven Angier <email@hidden>
- Date: Sat, 21 Sep 2002 10:57:58 +1000
On 21/9/02 3:56 AM, "Arthur J. Knapp" <email@hidden> wrote:
>
> item 5 of "abcdefgh"
>
> --> "e"
>
>
Yes, this has been the case for a long time. I haven't checked
>
recently, but this syntax also used to be just slightly faster
>
than "character X of STRING".
At one time, "Item" was a property of lists only. For strings, one had to
get characters or (slightly faster) "text n thru n of theString".
BTW: my simple testing indicates that "text n thru n" is still about 10%
faster than either "character" or "item" (at least on short strings):
StartTicks()
repeat 100000 times
--set theResult to item 5 of "abcdefgh" -- 238
--set theResult to character 5 of "abcdefgh" -- 238
set theResult to text 5 thru 5 of "abcdefgh" -- 213
end repeat
return {StopTicks(), theResult}
>
> The ASLG (v1.3.7) indicates that this shouldn't work. I think that this
>
> behaviour is a bug or, at best, a bad idea.
>
>
I like it. :)
It was a very hard to find "bug" for me in one of my older libraries.
Steven Angier
Macscript.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.