Re: Real Simple Question
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.