title: Java: parsing file path
body: <p>I need to parse a file path to get the filename from it. What confuses me is that windows uses <code>\</code> as the delimeter and linux - <code>/</code> and somehow the provided filepath can even contain both delimeters at the same time.</p>
  
  <p>Of course I can do:</p>
  
  <pre><code>int slash = filePath.lastIndexOf("/");
  int backslash = filePath.lastIndexOf("\\");
  fileName = filePath.substring(slash &gt; backslash ? slash : backslash);
  </code></pre>
  
  <p>but is there a better way in case I have more delimiters? (probably not for a file path)</p>