Get File Name Without Extension : File Name « File « Android






Get File Name Without Extension

  

class Main {

     public static String getFileNameWithoutExtension(String _path, String _pathSeperator,
           String _extensionSeperator) {
        try {
           int dot = _path.lastIndexOf(_extensionSeperator);
           int sep = _path.lastIndexOf(_pathSeperator);
           return _path.substring(sep + 1, dot);
        } catch (Exception ex) {
           return "Unknown";
        }
     }
}

   
    
  








Related examples in the same category

1.Get File Name With Extension