Re: When to use text VS text item
Re: When to use text VS text item
- Subject: Re: When to use text VS text item
- From: "J. Stewart" <email@hidden>
- Date: Sat, 6 Sep 2008 10:51:50 -0400
On 9/6/08 at 8:30 AM, Shane Stanley <email@hidden>
spake thusly:
The archived post gives a better example
That last example didn't work correctly (will teach me not to
use old text clippings). This one does.
set foo to "Now is the time for all good men to dress moose on
the tundra"
--> Script <--
my SrchRplc(foo, "good men", "hockey moms")
on SrchRplc(theTxt, srchStr, rplcStr)
local theTxt, temp, srchStr, rplcStr
# theTxt = text to be searched
# srchStr = text to be replaced
# rplcStr = text to replace with
if theTxt contains srchStr then
set {tids, my text item delimiters} to {my text item
delimiters, srchStr}
set temp to every text item of theTxt
set my text item delimiters to rplcStr
set theTxt to temp as text
set my text item delimiters to tids
end if
return theTxt
end SrchRplc
--> /Script <--
John
--
Any sufficiently advanced technology is indistinguishable from
magic. -Arthur C. Clarke
_______________________________________________
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