Re: Replacing a character/word
Re: Replacing a character/word
- Subject: Re: Replacing a character/word
- From: Emmanuel <email@hidden>
- Date: Tue, 17 Dec 2002 08:51:04 +0100
At 2:44 PM -0800 16/12/02, Domains4Days.com wrote:
-- ??? How do I replace a word or phrase? Like:
Set thisstuff to " this is a test"
-- ??? Replace (thisstuff , "test","CoolTest") ????
1. You don't want to use any third-party Scripting addition. Then you
use AppleScript's text item delimiters. There should be tested
samples at the usual places. Something by:
-------------untested
on Replace(x, a, b) -- "this is a test of replace", "test", "cool test"
set text item delimiters to a
set x to text items of a -- {"this is a ", " of replace"}
set text item delimiters to b
set x to x as list - "this is a cool test of replace"
return x
end
---------------------
2. You may use a third-party Scripting addition. The Satimage osax, a
freeware, offers "change":
---------------------
on Replace(x, a, b)
change a into b in x
end
---------------------
"change" supports Regular expressions.
HTH,
Emmanuel
<netiquette> from the company that makes the Satimage osax </netiquette>
_______________________________________________
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.