Re: Replacing characters in a string
Re: Replacing characters in a string
- Subject: Re: Replacing characters in a string
- From: "Serge Belleudy-d'Espinose" <email@hidden>
- Date: Sun, 12 Nov 2000 12:54:56 +0100
At 17:07 -0500 11/11/00, Matthew Fischer wrote:
How would I change this:
repeat with i from ((length of file_name) - 10) to length of file_name
if character i of file_name is not ":" then
set new_file_name to new_file_name & character i of file_name
end if
end repeat
To check for multiple characters, instead of just the colon? What I
really want to do is make sure the character is not a colon, a space
or an ampersand.
set new_file_name to text -10 thru end of file_name
set xDelimiters to {":", " ", "ampersand"}
-- don't forget to replace 'ampersand' with actual ampersand :)
set oldTID to AppleScript's text item delimiters
repeat with xDelimiter in xDelimiters
set AppleScript's text item delimiters to "" & xDelimiter
set new_file_name to text items in new_file_name
set AppleScript's text item delimiters to ""
set new_file_name to "" & new_file_name
end repeat
set AppleScript's text item delimiters to oldTID
Side question: why are TIDs labelled delimiter_s_ ? what does that imply?
Serge
__ __ __
_ \///\/ _ I N S T I T U T | Serge Belleudy-d'Espinose - IJM
\///\/// J A C Q U E S | 2 place Jussieu - 75251 Paris Cedex 05
_///\///\_ M O N O D | m@il : email@hidden
__/\///\__ Service Informatique | WWW :
http://www.ijm.jussieu.fr/