• 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: Manipulate the last item in a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Manipulate the last item in a string


  • Subject: Re: Manipulate the last item in a string
  • From: kai <email@hidden>
  • Date: Sat, 17 Jun 2006 19:36:18 +0100


On 17 Jun 2006, at 19:15, Andrew Oliver wrote:

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.

I kinda feared this would end up as a debate about best practice, Andrew. ;-)


Yes, in a long, complex script, I agree that storing/restoring the current tids value is sensible. I can also see the point made by those who prefer to set the value of tids *before* performing tid- based text manipulation, rather than afterwards. However, for a relatively simple routine, such as the short snippet offered as an example, I don't personally have a problem with the approach taken. :-)

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: 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>)

  • Prev by Date: Re: Manipulate the last item in a string
  • Next by Date: Re: Manipulate the last item in a string
  • Previous by thread: Re: Manipulate the last item in a string
  • Next by thread: Re: Manipulate the last item in a string
  • Index(es):
    • Date
    • Thread