Gets the extension of the specified file name. @param fileName the file name with or without path @return the extension, or null if none
(String fileName)
| 247 | * @return the extension, or null if none |
| 248 | */ |
| 249 | public static String getExtension(String fileName) { |
| 250 | if(fileName==null) { |
| 251 | return null; |
| 252 | } |
| 253 | int i = fileName.lastIndexOf('.'); |
| 254 | int j = forwardSlash(fileName).lastIndexOf('/'); |
| 255 | if(i>0 && i<fileName.length()-1 && i>j) { |
| 256 | return fileName.substring(i+1); |
| 257 | } |
| 258 | return null; |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * Gets a simple class name for the specified class type. |