• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Replacing characters in a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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/


References: 
 >Replacing characters in a string (From: Matthew Fischer <email@hidden>)

  • Prev by Date: Entire content (Re: Maintaining large website / finding many files)
  • Next by Date: Re: stack overflow avoidance?
  • Previous by thread: Re: Replacing characters in a string
  • Next by thread: Re: Replacing characters in a string
  • Index(es):
    • Date
    • Thread