public static String getFileNameWithoutExtenxion ( String fileName ) { if ( fileName == null ) { return null ; } else { int number = fileName . lastIndexOf ( ' ' ) ; if ( number >= 0 ) { return fileName . substring ( 0 , number ) ; } else { return fileName ; } } }
If the file is like name . extension This function returns name for filename = name . this returns name for filemane = name this retuns name ; for filemane = . extension this retuns ; for filemane = . this retuns ;