• 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: multiple text delimiters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multiple text delimiters


  • Subject: Re: multiple text delimiters
  • From: Michelle Steiner <email@hidden>
  • Date: Tue, 27 Sep 2005 14:51:29 -0700


On Sep 27, 2005, at 2:21 PM, Patrick J. Collins wrote:

Is there a way to set applescripts text delimiters to more than one character?

You can have a string as delimiters; e.g.,

set applescript's text item delimiters to "abcd"

Like if I wanted to remove all characters "[" "]" "(" and ")" from a string?

You would have to loop through with each character.

set the target_string to "[this] is (a) (test) (sentence.]"
set the removal_string to {"]", "[", "(", ")"}

repeat with this_delimiter in the removal_string
    set AppleScript's text item delimiters to this_delimiter
    set the temp_list to the text items of the target_string
    set AppleScript's text item delimiters to ""
    set the target_string to the temp_list as text
end repeat
target_string

--> "this is a test sentence."

Theoretically, text item delimiters can be a list of strings, but it's never been implemented to do that.

-- Michelle

--
"Cut the red wire (clip) (turn page) but first...."

_______________________________________________
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


  • Follow-Ups:
    • Re: multiple text delimiters
      • From: "Gary (Lists)" <email@hidden>
References: 
 >multiple text delimiters (From: "Patrick J. Collins" <email@hidden>)

  • Prev by Date: Re: Object inheritance question...
  • Next by Date: Re: Records
  • Previous by thread: multiple text delimiters
  • Next by thread: Re: multiple text delimiters
  • Index(es):
    • Date
    • Thread