title: How to split string to arguments like shell?
body: <p><a href="https://stackoverflow.com/questions/367706/is-there-a-good-command-line-argument-parser-for-java">Here</a> is a list of argument parser, but they accept string array.</p>
  
  <p>Now, I got a string like </p>
  
  <pre><code>-s -d "String with space" -d "string with \" escape \n the next line"
  </code></pre>
  
  <p>I want to split the string to </p>
  
  <pre><code>-s
  -d
  String with space
  -d
  string with " escape
  the next line (This is one string with \n)
  </code></pre>
  
  <p>Is there any tool to do this ? </p>
  
  <p><strong>SEE ALSO</strong></p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/7804335/">split-string-on-spaces-except-if-between-quotes-i-e-treat-hello-world-as</a></li>
  <li><a href="https://stackoverflow.com/questions/3259143/">split-a-string-containing-command-line-parameters-into-a-string-in-java</a></li>
  </ul>
  
  <p><strong>EDTIED</strong></p>
  
  <p>Post as answer.</p>