Here you can find the source of splitDirString(String dirSection)
public static String[] splitDirString(String dirSection)
//package com.java2s; public class Main { public static String[] splitDirString(String dirSection) { if (dirSection == null || "".equals(dirSection.trim())) return null; dirSection = dirSection.trim();// ww w . ja v a 2 s . co m if ('/' == (dirSection.charAt(0))) { dirSection = dirSection.substring(1); } if (dirSection != null && !"".equals(dirSection)) { if ('/' == (dirSection.charAt(dirSection.length() - 1))) { dirSection = dirSection.substring(0, dirSection.length() - 1); } } if (dirSection != null && !"".equals(dirSection)) { String[] dirs = dirSection.split("/"); return dirs; } return null; } }