MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / getExtension

Method getExtension

src/org/opensourcephysics/controls/XML.java:249–259  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 15

actionPerformedMethod · 0.95
saveMethod · 0.95
acceptMethod · 0.95
getTypeFromPathMethod · 0.95
saveAsMethod · 0.95
runMeMethod · 0.95
setTabSetNameMethod · 0.95
getSearchCacheFileMethod · 0.95
getURIPathMethod · 0.95
createZipResourceMethod · 0.95
doCommandMethod · 0.95
getChooserSavePathMethod · 0.95

Calls 2

forwardSlashMethod · 0.95
lengthMethod · 0.80

Tested by 1

defineZipFilePathMethod · 0.76