Summary: TID (Text Item Delimiters)
Summary: TID (Text Item Delimiters)
- Subject: Summary: TID (Text Item Delimiters)
- From: Robert Poland <email@hidden>
- Date: Fri, 30 May 2003 11:57:46 -0600
>
> 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
As several people pointed I need to specify TEXT item. I had falsely
assumed that by defining a space as a TID then as a "" all spaces
would be replaced with a "".
Turns out that the following did what I wanted.
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 "-" -- seperate
into three words
set readData to (characters 1 thru 3 of text item 2 of readData)
set AppleScript's text item delimiters to ""
return {readData}
end shortenMonth
Thanks,
--
Bob Poland - Englewood, CO
http://www.ibrb.org/
_______________________________________________
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.