• 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: changing part of a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing part of a string


  • Subject: Re: changing part of a string
  • From: Michelle Steiner <email@hidden>
  • Date: Sun, 27 Jan 2008 19:19:05 -0700

On Jan 27, 2008, at 6:02 PM, Patrik B. wrote:

I have a path that I need to change slightly:

Example:

G5:bigfolder:2 color:myfolder:image1.eps -- I need to change "2 color" only

G5:bigfolder:CMYK images:myfolder:image1.eps

How do I replace out just "2color" to "CMYK color" is it possible to search
and replace parts of a string or do I have to change my text item delimiters
to ":" and then replace out item 3 with the new text?


In my test scenario it will be always item 3 but is there a way to address
simply a specific section in an image path and replace that in a sort of
search and replace.


G5:bigfolder:2ndfolder:CMYK images:myfolder:image1.eps

Assuming you know the text you wish to replace, you can do it this way:

set foo to "G5:bigfolder:2 color:myfolder:image1.eps"
set text item delimiters to "2 color"
set foobar to text items of foo
set text item delimiters to "CYMK images"
set foo to foobar as text

-- Michelle

--
"Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed."
President Dwight D. Eisenhower, April 16, 1953


_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >changing part of a string (From: "Patrik B." <email@hidden>)

  • Prev by Date: Re: Getting selected event in iCal
  • Next by Date: Is iCal slower?
  • Previous by thread: changing part of a string
  • Next by thread: Re: changing part of a string
  • Index(es):
    • Date
    • Thread