Re: Find and replace string
Re: Find and replace string
- Subject: Re: Find and replace string
- From: Michael Gmail <email@hidden>
- Date: Tue, 1 Nov 2005 12:28:36 -0600
On Nov 1, 2005, at 10:56 AM, Steve Foster wrote:
I am trying to work out a simple find and replace script.
I need it to replace a ^ with a carriage return.
The "standard" string s&r method in AppleScript makes use of "text
item delimiters". This is from Apple's "Replace Text in Item Names"
script, which is probably on your system:
set AppleScript's text item delimiters to the search_string
set the text_item_list to every text item of the current_name
set AppleScript's text item delimiters to the replacement_string
set the new_item_name to the text_item_list as string
Some scripters recommend storing the existing TIDs to a variable and
re-setting them at the end of your routine.
What happens in the second line is that the main text is split up at
the occurrences of the search text and stored as an array (or "list"
in AS lingo) of substrings excluding the search text itself. The
third line assigns a new value (the replace string) to the delimiter,
which is then used to reassemble the string from the list of
substrings in the fourth line.
Michael
--
Ukončete výstup a nástup, dveře se zavírají.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden