Re: Tidying a string
Re: Tidying a string
- Subject: Re: Tidying a string
- From: Martin Orpen <email@hidden>
- Date: Thu, 28 Apr 2005 18:42:28 +0100
on 28/4/05 18:19, Marc Rubin at email@hidden wrote:
>> I'd like to strip all
>> unnecessary spaces and get "foo bar foo bar foo bar".
>
> is it considered 'vanilla' enough to script the shell to use grep to
> replace:
>
> "^ +" with ""
>
> " +$" with "".
>
> " +" with " "
That's far too fruity!
How about this for *vanilla shell*:
set t to " foo bar foo bar foo bar "
do shell script "echo " & t & " | tr ' ' ' '"
-->"foo bar foo bar foo bar"
:-)
--
Martin Orpen
_______________________________________________
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