• 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: Tidying a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tidying a string


  • Subject: Re: Tidying a string
  • From: Emmanuel <email@hidden>
  • Date: Thu, 28 Apr 2005 21:54:10 +0200

At 5:42 PM +0100 4/28/05, pete boardman wrote:
Given a text string such as " foo bar foo bar foo bar ", where there are a variable number of spaces between each word, and 0 or more spaces at both start and end, I'd like to strip all unnecessary spaces and get "foo bar foo bar foo bar". I can't seem to get text delimiters working to do this. Is there an easy and fast way?

Maybe that's easy and fast:
1 - install Satimage.osax <http://www.satimage-software.com/en/downloads_osaxen.html>
2 - run:


set s to "   foo    bar foo    bar foo bar   "
change {"^ +", " +", " +$"} into {"", " ", ""} in s with regexp
  --  "foo bar foo bar foo bar"

Emmanuel
Satimage-software
_______________________________________________
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: Tidying a string
      • From: pete boardman <email@hidden>
    • Re: Tidying a string
      • From: pete boardman <email@hidden>
References: 
 >Tidying a string (From: pete boardman <email@hidden>)

  • Prev by Date: Re: Tidying a string
  • Next by Date: Exiting from an Applescript
  • Previous by thread: Re: Tidying a string
  • Next by thread: Re: Tidying a string
  • Index(es):
    • Date
    • Thread