title: Removing unused spaces and commas from a string in Java
body: <p>I have a question, and I'm sure there is a relatively simple answer to this, but at the moment I'm having a massive brain fart and can't seem to think of an elegant solution that doesn't involve a ridiculous myriad of if statements.</p>
  <p>Basically, I have a web page that is dynamically updating the users present into a string, stylised as such</p>
  <blockquote>
  <p>User1, User2, User3, User4</p>
  </blockquote>
  <p>However, when I delete one of these users, from a different location, they are removed from the list, but I'm left with the following</p>
  <p><em>Beginning</em></p>
  <blockquote>
  <p>, User2, User3, User4</p>
  </blockquote>
  <p><em>Middle</em></p>
  <blockquote>
  <p>User1, , User3, User4</p>
  </blockquote>
  <p><em>End</em></p>
  <blockquote>
  <p>User1, User2, User3,</p>
  </blockquote>
  <p>If anyone knows of a relatively easy way to remove these unwanted commas, that would be really helpful; it's been bugging me for hours.</p>