title: How to split directory path components in string in java
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6174182/how-to-split-the-string-in-java">how to split the string in java</a>  </p>
  </blockquote>
  
  
  
  <pre class="lang-java prettyprint-override"><code>FileSystemView fsv = FileSystemView.getFileSystemView();
  File[] roots = fsv.getRoots();
  for (int i = 0; i &lt; roots.length; i++)
  {
    System.out.println("Root: " + roots[i]);
  }
  System.out.println("Home directory: " + fsv.getHomeDirectory());
  </code></pre>
  
  <p>Root: C:\Users\RS\Desktop
  Home directory: C:\Users\RS\Desktop</p>
  
  <p>I want cut the root or Home Directory components like 
  String C, Users, RS, Desktop</p>