• 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: Simple substring help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple substring help


  • Subject: Re: Simple substring help
  • From: Christopher Stone <email@hidden>
  • Date: Fri, 5 Dec 2003 11:45:17 -0600

At 11:06 -0600 12/05/2003, Wade Williams wrought:

set string1 to "MyHD:Folder:SubFolder:File:"

what's the easiest way to accomplish chopping off the "File:" at the end?
______________________________________________________________________

Hello Wade,

This process is far less than intuitive:

set string1 to "MyHD:Folder:SubFolder:File:"
set AppleScript's text item delimiters to {":"}
set ti to (text items of string1)
set newString to ((text items 1 thru -3 of string1) & "") as string
set AppleScript's Text Item Delimiters to {""}

Personally I prefer to use the Satimage osax for such things:

set string1 to "MyHD:Folder:SubFolder:File:"

set newString to change "[^:]+:$" into "" in string1 with regexp without case sensitive

--> MyHD:Folder:SubFolder:

Satimage osax (freeware): <http://www.satimage.fr/software/en/softx.html>


Chris
_______________________________________________
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: 
 >Simple substring help (From: Wade Williams <email@hidden>)

  • Prev by Date: Re: Coerce time
  • Next by Date: Re: make a list
  • Previous by thread: Re: Simple substring help
  • Next by thread: RE: Simple substring help
  • Index(es):
    • Date
    • Thread