• 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: String to multiple-item list coercion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: String to multiple-item list coercion
      • From: Paul Berkowitz <email@hidden>
References: 
 >Re: String to multiple-item list coercion (From: "Arthur J. Knapp" <email@hidden>)

  • Prev by Date: [OFF] Re: Ready made OSAX or script for a lazy programmer
  • Next by Date: Re: String to multiple-item list coercion
  • Previous by thread: Re: String to multiple-item list coercion
  • Next by thread: Re: String to multiple-item list coercion
  • Index(es):
    • Date
    • Thread