• 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: Trim?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trim?


  • Subject: Re: Trim?
  • From: Paul Skinner <email@hidden>
  • Date: Sun, 4 Aug 2002 11:13:10 -0400

On Sunday, August 4, 2002, at 06:42 AM, Nigel Garvey wrote:

Paul Skinner wrote on Sat, 3 Aug 2002 18:53:58 -0400:

I realize now that the version below is more efficient requiring only 15
loops to handle the 160 character run text...

How about this version of yours?

set inputText to " email@hidden 'This is a > string?' "
cleanSpaces(inputText)
-->"email@hidden 'This is a > string?'"

on cleanSpaces(inputText)
set space2 to space & space
set inputText to space & inputText & space
repeat while inputText contains space2
set AppleScript's text item delimiters to space2
set tempS to text items of inputText
set AppleScript's text item delimiters to space
set inputText to tempS as text
end repeat
set AppleScript's text item delimiters to ""
return text 2 thru -2 of inputText
end cleanSpaces

NG


Primo.

This is the functional loop and nothing else. It loops only round
( square root of (the length of the longest run of spaces) rounding up) times.

Bravo.
--
Paul Skinner
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Trim? (From: Nigel Garvey <email@hidden>)

  • Prev by Date: Re: "+" and "-" are numbers.
  • Next by Date: Eudora Reply-to Mk II
  • Previous by thread: Re: Trim?
  • Next by thread: Re: Trim?
  • Index(es):
    • Date
    • Thread