• 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: TID (Text Item Delimiters)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TID (Text Item Delimiters)


  • Subject: Re: TID (Text Item Delimiters)
  • From: Michelle Steiner <email@hidden>
  • Date: Fri, 30 May 2003 10:30:14 -0700

On Friday, May 30, 2003, at 09:48 AM, Robert Poland wrote:

Speaking of TIDs, Why doesn't the following remove spaces? and why
are the letters items and not words?

set readData to " 2 7 -June-2003"
my shortenMonth(readData)
display dialog ">" & result & "<" as string -- arrows for clarity


on shortenMonth(readData) -- set month to first 3 characters
set AppleScript's text item delimiters to " " -- set TID to space
set AppleScript's text item delimiters to "" -- remove spaces
set AppleScript's text item delimiters to "-" -- seperate into three words
set theMonth to item 2 of readData
display dialog theMonth as string
set result to (characters 1 thru 3 of readData)
set readData to (result)
set AppleScript's text item delimiters to ""
return {readData}
end shortenMonth

The only text item delimiter being used is "-", but you haven't used the text item delimiters at all in your script; all you have done is set them to various values.

Item 2 of readData is "2" because the second character of " 2 7 -June-2003" is "2"; and when you ask for an item of a string, the string is coerced into a list of characters.

An item of a string is not the same as a text item of the string, unless the text item delimiters happens to be "".

--Michelle

--
"There's some good in the world, Mr. Frodo, and it's worth fighting for."
_______________________________________________
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.
References: 
 >TID (Text Item Delimiters) (From: Robert Poland <email@hidden>)

  • Prev by Date: TID (Text Item Delimiters)
  • Next by Date: Re: Faster List Checking
  • Previous by thread: TID (Text Item Delimiters)
  • Next by thread: Re: TID (Text Item Delimiters)
  • Index(es):
    • Date
    • Thread