List of usage examples for java.lang String lastIndexOf
public int lastIndexOf(String str)
From source file:Main.java
public static String getFileNameFromURL(String url) { return url.substring(url.lastIndexOf("/") + 1, url.length()); }
From source file:Main.java
public static String getFilePath(String path) { int end = path.lastIndexOf("/"); if (end != -1) { return path.substring(0, end); } else {/*from ww w .ja v a 2s . co m*/ return null; } }
From source file:Main.java
public static String getPathFromFilepath(String filepath) { int pos = filepath.lastIndexOf('/'); if (pos != -1) { return filepath.substring(0, pos); }// w w w . ja v a2 s. com return ""; }
From source file:Main.java
public static String GetFileName(String path) { return path.substring(path.lastIndexOf("/") + 1); }
From source file:Main.java
public static String getFileName(String path) { int index = path.lastIndexOf("/") + 1; String tmp = path.substring(index); if (tmp.indexOf("?") > -1) { tmp = tmp.substring(0, tmp.indexOf("?")); }//from w w w . j a v a 2 s .c om return tmp; }
From source file:Main.java
/** @since 5.3.0 */ public static String toFileSuffix(String fileName) { int dotx = fileName.lastIndexOf('.'); return dotx < 0 ? "" : fileName.substring(dotx + 1); }
From source file:Main.java
public static String changeFileExt(String name, String ext) { if (name.lastIndexOf('.') > -1) return name.substring(0, name.lastIndexOf('.')) + ext; else/*from ww w . ja va 2s . co m*/ return name + ext; }
From source file:Main.java
public static String getNameFromFilepath(String filepath) { int pos = filepath.lastIndexOf('/'); if (pos != -1) { return filepath.substring(pos + 1); }//from w ww. j a v a2s . c o m return ""; }
From source file:Main.java
public static String getFileName(String path) { return path.substring(path.lastIndexOf("/") + 1); }
From source file:Main.java
/** * get outer Class name//from w w w .j a v a 2 s . com * @param className * @return */ private static String getOuterClassName(String className) { int idx = className.lastIndexOf('.') + 1; return className.substring(idx); }