title: A more elegant solution to creating an array from comma sep list of properties?
body: <p>In my properties file I have one property, which contains a comma separated list of values</p>
  
  <p>In my code, I would like to load that property in, split it from the commas, and add each value into an array. I also want to make sure I don't have values in the array due to whitespace etc</p>
  
  <p>example property : </p>
  
  <pre><code>prop_allowed_extensions = .jpeg,tiff, .txt 
  </code></pre>
  
  <p>I have come up with this so far, but it feels dirty, is there a more elegant solution?</p>
  
  <pre><code>String test = classProperties.getProperty("prop_allowed_extensions", "txt, jpeg");
  String[] splitString = StringUtils.split(test, ',');
  String[] newString = new String[splitString.length];             
  for (int i = 0; i &lt; splitString.length; i++)
  {
     newString[i] = StringUtils.trim(splitString[i]);                
  }
  </code></pre>
  
  <p>I just want the text of the file extension, would it be appropriate to use a regular expression to remove whitespace/non-letters?</p>