remove many spaces but leave single spaces

I am trying to remove the large blocks of space around the text. Leave at least one single space between words and have no spaces at the beginning and the end. I tried changing the delimeter " " to “” but all that did was take away the spaces between the words and left huge blocks of text.
"

      GOING 

        GREEN  

       

     

        

     

        

      

       

        "   I'd like to change this to "Going Green"

Browser: Safari 419.3
Operating System: Mac OS X (10.4)

One way using text item delimiters:


set myText to "

         

           

         

          GOING

            GREEN 

           

         

           

         

           

         

           

            "
set w to words of myText
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to space
set myText to w as string
set AppleScript's text item delimiters to tid
myText --> "GOING GREEN"

You might not want to use ‘words’ if your text contains non-alphanumeric characters. In that case, you can use two spaces as delimiter (e.g. space & space), but what about the carriage returns?

gl,