• 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: has <email@hidden>
  • Date: Fri, 20 Sep 2002 22:56:37 +0100

Steven Angier wrote:

>I may choose to live under a nice cosy rock, but I just learned that
>strings can be coerced to multiple-item lists:
>
> set {a, b, c, d, e} to "abcdefgh"
> return {a, b, c, d, e}
> --> {"a", "b", "c", "d", "e"}

This isn't a coercion, it's a multiple assignment. Comparable to:

set {a, b, c, d, e} to {"a", "b", "c", "d", "e", "f", "g", "h"}


>Similarly, one can now query a particular item of a string:
>
> item 5 of "abcdefgh"
> --> "e"

Again, not a new behaviour. Not too dissimilar to 'character 5 of
"abcdefgh"'. Both strings and lists are composite [multi-item] objects.
Think of a string as an array of characters - I think it makes sense for
string and list types to display some behaviours in common. For example,
consider:

repeat with aChar in aString
...
end repeat


>The ASLG (v1.3.7) indicates that this shouldn't work.

Does it mention it at all? (I could see 'characters of...', etc. described,
but I only had a quick flick-through. Did I miss something specific?)

HTH

has

--
http://www.barple.pwp.blueyonder.co.uk -- The Little Page of AppleScripts
_______________________________________________
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: Steven Angier <email@hidden>
  • Prev by Date: Re: Ready made OSAX or script for a lazy programmer [HTML encoding]
  • Next by Date: Re: Exporting Eudora mailboxes as text to structured folders
  • Previous by thread: Re: String to multiple-item list coercion
  • Next by thread: Re: String to multiple-item list coercion
  • Index(es):
    • Date
    • Thread