title: Escaping ',' separator while splitting using String.split()
body: <p>I am trying to read a file and hence I am splitting the fields when I receive <code>','</code> comma separator . However some fields have <code>','</code> in them but they are enclosed within double quotes hence how can I split it escaping the <code>,</code> separator.
  Here is what I have done</p>
  
  <pre><code>String[] cols = line.split(Pattern.quote(","));
  </code></pre>
  
  <p>How should I modify this using <code>split()</code> only in Java. Also what changes will I have to make in case the separator is a pipe <code>'|'</code>?</p>