• 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: Real Simple Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Real Simple Question


  • Subject: Re: Real Simple Question
  • From: "Marc K. Myers" <email@hidden>
  • Date: Wed, 6 Nov 2002 16:53:29 -0500

Date: Wed, 06 Nov 2002 10:18:34 -0500
Subject: Real Simple Question
From: Joey Parshley <email@hidden>
To: <email@hidden>

I am trying to learn AS and I see references to tid's. What does that mean?

AppleScript's text item delimiters are the characters used to separate one text item from another. The default is "" (the null character). If you leave the AppleScript's text item delimiters alone and do this:

set theText to "Mary had a little lamb"
set theItems to text items of theText

the result would be

{"M", "a", "r", "y", " ", "h", "a", "d", " ", "a", " ", "l", "i", "t", "t", "l", "e", " ", "l", "a", "m", "b"}

because all characters are separated by the null character.

If you set AppleScript's text item delimiters to a space you'd get this:

set AppleScript's text item delimiters to {space}
set theText to "Mary had a little lamb"
set theItems to text items of theText

-->{"Mary", "had", "a", "little", "lamb"}

If you set them to "a" you'd get this:

set AppleScript's text item delimiters to {"a"}
set theText to "Mary had a little lamb"
set theItems to text items of theText

-->{"M", "ry h", "d ", " little l", "mb"}

AppleScript's text item delimiters are useful for all kinds of search and replace functions because you can divide up text based on the search string being assigned as AppleScript's text item delimiters, changing AppleScript's text item delimiters to the replace string, and putting the text items back together as a string.

set AppleScript's text item delimiters to {"little"}
set theText to "Mary had a little lamb"
set theItems to text items of theText
set AppleScript's text item delimiters to {"lot of"}
set theText to (theItems as text)

-->"Mary had a lot of lamb"

Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074

[11/06/02 4:49:56 PM]
_______________________________________________
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.

  • Prev by Date: Re: How do I Read and Write a list to a file
  • Next by Date: Re: applescript-users digest, Vol 3 #1038 - 14 msgs
  • Previous by thread: Re: Real Simple Question
  • Next by thread: login script
  • Index(es):
    • Date
    • Thread