• 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: How do I delete the 1st three characters from a variable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I delete the 1st three characters from a variable


  • Subject: Re: How do I delete the 1st three characters from a variable
  • From: kai <email@hidden>
  • Date: Wed, 4 Jan 2006 01:34:37 +0000


On 4 Jan 2006, at 00:23, Michelle Steiner wrote:

On Jan 3, 2006, at 4:30 PM, kai wrote:

On 3 Jan 2006, at 23:08, Shane Stanley wrote:

Ignoring the opinion about -1 vs end (which I disagree with, but again only
as a matter of opinion), these two are quite different. The latter is more
inefficient -- it creates an unnecessary list and then coerces it -- and it
also potentially raises issues if myImageName is Unicode text by virtue of
its coercion to string class.

The result of such a coercion is also dependent on the current value of AppleScript's text item delimiters. This can (and occasionally does) catch folks out - especially if they're not fully aware of the implications.

What is the matter with using "text" instead of "characters" and coercing to a string?

Not much - if you really want a string, Michelle. The point we were really making is that, since we're already dealing with text, it's generally preferable (for reasons of efficiency and robustness) to use <text x thru y> rather than <characters x thru y as string>.


That way, if the incoming text is Unicode text, then the result will also be Unicode text. For many purposes (especially when dealing with file paths and names), it's probably best left in that form - so there would be little point in the extra coercion to string.

If for some reason Unicode text is undesirable in a particular situation, then a regular coercion to string might do the trick. But it's perhaps worth noting that, although the result will have a class of 'string', it will still contain some encoded style data. I'll resist the temptation here to wander off-topic by enlarging on that - although, if you're interested, you might like to check out this discussion a little earlier:

http://bbs.applescript.net/viewtopic.php?id=15464

PS: Apologies for the frequent use of words like "text" and "string" - which may mean different things depending on context (just to add to the confusion). ;-)

---
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
  • Follow-Ups:
    • Re: How do I delete the 1st three characters from a variable
      • From: Michelle Steiner <email@hidden>
References: 
 >Re: How do I delete the 1st three characters from a variable (From: Shane Stanley <email@hidden>)
 >Re: How do I delete the 1st three characters from a variable (From: kai <email@hidden>)
 >Re: How do I delete the 1st three characters from a variable (From: Michelle Steiner <email@hidden>)

  • Prev by Date: get size of available screen fails
  • Next by Date: Re: How do I delete the 1st three characters from a variable
  • Previous by thread: Re: How do I delete the 1st three characters from a variable
  • Next by thread: Re: How do I delete the 1st three characters from a variable
  • Index(es):
    • Date
    • Thread