title: Replacing Only Certain White Spaces In a String
body: <p>I have string <code>queryInputNameString</code> that is equal to <code>fir, spotted owl</code> and I'm trying to use <code>replaceAll()</code> to remove the white spaces and <code>split()</code> to separate the elements in the <code>inputNameArray</code> array when a comma occurs.</p>
  
  <pre><code>String noSpaces = queryInputNameString.replaceAll("\\s+","");
  String[] inputNameArray = noSpaces.split("\\,");
  </code></pre>
  
  <p>So far the above returns:</p>
  
  <pre><code>fir
  spottedowl
  </code></pre>
  
  <p>but I would like it to only remove the white spaces that occurs immediately before or after a comma and return this:</p>
  
  <pre><code>fir
  spotted owl
  </code></pre>
  
  <p>How can I make my code ignore white spaces that are not preceded/followed by a comma?</p>
  
  <p>Thanks.</p>