• 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: Removing characters from a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Removing characters from a string


  • Subject: Re: Removing characters from a string
  • From: Paul Skinner <email@hidden>
  • Date: Mon, 4 Nov 2002 16:58:04 -0500

On Monday, November 4, 2002, at 09:51 AM, John Delacour wrote:

At 4:48 pm -0500 29/10/02, Paul Skinner wrote:

if length of (n as string) is greater than 32 then set n to (n as string)'s text 1 thru 32

In the interests of brvty.... it is unnec to chck the len, and this will do:

set n to text 1 thru 32 of ("" & n)

hmm... I thought that this was something I didn't know, but it fails for me with less than 32 characters.
OS 10.2.1/AS 1.9

JD

set s to "this/might not.be a legal:name, then again, it could be."
do shell script "perl -e '$_ = qq~" & s & "~; s~\\.|,|:|/~~g; print'"
text 1 through 32 of result

smartypants! :)

Perl rocks, but I haven't yet learned enough for it to be usable for me.
Hmmmm.... This also fails for me if there's less than 32 characters.
--
Paul Skinner
_______________________________________________
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: 
 >Re: Removing characters from a string (From: John Delacour <email@hidden>)

  • Prev by Date: iCal scripting samples
  • Next by Date: Looping through a list question...
  • Previous by thread: Re: Removing characters from a string
  • Next by thread: Re: Removing characters from a string
  • Index(es):
    • Date
    • Thread