• 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: 'change'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'change'


  • Subject: Re: 'change'
  • From: email@hidden (Michael Sullivan)
  • Date: Tue, 4 Dec 2001 17:11:35 -0500
  • Organization: Business Card Express of Connecticut

> I've recently reinstalled my OS, but in the process, I seemed to have lost
> one of my Applescript Additions. Unfortunately, I have no idea what I'm
> missing.

> The Applescript command that no longer triggers is:

> change x into y in z

> as in:

> set theAuthor to (change "By " into "" in theAuthor)


> I'm pretty sure I remember having added an Applescript addition to get
> this search and replace feature.

> (doesn't it strike others as odd that Apple didn't include even base text
> functions like this in a standard library?!?)

In this case no, because it can be implemented quite easily with TIDs

-- begin script

on searchReplace(theText, searchString, replaceString)

set oldTIDs to text item delimiters
set text item delimiters to searchString

set newText to theText as list

set text item delimiters to {replaceString}

return newText as string

end searchReplace

-- end script

I can't even take credit for this one because I've seen it or something
essentially similar in about a half dozen scripts posted here.

The one thing I can't figure out how to do with TIDs is to break things
into words for processing but *remembering* what kind of whitespace
delimited them. I keep thinking I'll come up with a clever trick but
it's just not happening.


Michael

--
Michael Sullivan email@hidden
Business Card Express of Connecticut Thermographers to the Trade
"You hate your job -- why didn't you say so? There's a support group
for that. It's called everybody; they meet at the bar." -Drew Carey


  • Follow-Ups:
    • Re: 'change'
      • From: Emmanuel <email@hidden>
    • Re: 'change'
      • From: garbanzito <email@hidden>
References: 
 >'change' (From: Cameron Knowlton <email@hidden>)

  • Prev by Date: Re: Check images in QX
  • Next by Date: Re: <<event FNDRsope>> (WAS Re: Path to app ...)
  • Previous by thread: 'change'
  • Next by thread: Re: 'change'
  • Index(es):
    • Date
    • Thread