Re: 'change'
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
References: | |
| >'change' (From: Cameron Knowlton <email@hidden>) |