title: How to remove duplicate white spaces in a string?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6163169/removing-whitespace-from-string-in-javascript">Removing whitespace from string in JavaScript</a>  </p>
  </blockquote>
  
  
  
  <p>I have used trim function to remove the white spaces at the beginning and end of the sentences. If there is to much white spaces in between words in a sentence, is there any method to trim?</p>
  
  <p>for example </p>
  
  <pre><code>"abc                  def. fds                            sdff."
  </code></pre>