Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Manipulate the last item in a string




Le 17 juin 2006, à 20:15, Andrew Oliver a écrit :

On Jun 17, 2006, at 10:54 AM, kai wrote:

As you know, AppleScript's Text Item Delimiters property consists of a list of strings used as delimiters. Its initial value is a single-item list containing an empty string: {""}. AppleScript has (thus far) used only the first delimiter in the list - and a regular string works just as well. In fact, I've found it generally faster (especially in routines that frequently switch the tids value) to use strings. However, when finally restoring the property to its initial value, I tend to revert to the list form - to preserve at least some semblance of consistency... ;-)
Surely the best way of maintaining consistency is to restore the TIDs to whatever they were before you changed them rather than the default. This is a better solution because it'll restore them to the script's previous setting which may be different from the default.

set t to "1234.jpg, 5678.jpg, 4444.jpg, 5555.jpg, 9876.jpg, 6969.jpg."
set {oldTIDs, text item delimiters} to {text item delimiters, ", "}
set t to t's text 1 thru text item -2 & " & " & t's text item -1
set text item delimiters to oldTIDs
Andrew


Thank you to kai and Andrew.
Today I learnt something and this is a good thing.

Have a good day for yourself.
On my side, I am tired and go to sleep.

Yvan KOENIG
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden

References: 
 >Manipulate the last item in a string (From: Marine Themes <email@hidden>)
 >Re: Manipulate the last item in a string (From: kai <email@hidden>)
 >Re: Manipulate the last item in a string (From: Yvan KOENIG <email@hidden>)
 >Re: Manipulate the last item in a string (From: kai <email@hidden>)
 >Re: Manipulate the last item in a string (From: Andrew Oliver <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.