List of usage examples for java.lang String lastIndexOf
public int lastIndexOf(String str)
From source file:Main.java
public static String getShortClassName(String fullClassName) { int lastDot = fullClassName.lastIndexOf("."); if (lastDot >= 0) { return fullClassName.substring(lastDot + 1, fullClassName.length()); }/* ww w .j av a 2s . com*/ return fullClassName; }
From source file:Main.java
public static String getLastStep(String xpStr) { int lastSlash = xpStr.lastIndexOf("/"); String result = ""; if (lastSlash != -1) { result = xpStr.substring(lastSlash + 1); }//from w ww . j a v a 2 s .c o m return result; }
From source file:Main.java
private static String getFileName(String localPath) { return localPath.substring(localPath.lastIndexOf("/") + 1); }
From source file:Main.java
private static String getFileNameFromPath(String filePath) { int begin = filePath.lastIndexOf(File.separator); int end = filePath.lastIndexOf("."); if (end < 1) { return null; }/*from w w w .jav a 2 s. c om*/ String fileName = filePath.substring(begin + 1, end); return fileName; }
From source file:Main.java
public static String getImgExt(final String imgLoc) { return imgLoc.substring(imgLoc.lastIndexOf("."), imgLoc.length()); }
From source file:Main.java
static public String getClassNameOnly(String clsName) { return clsName.substring(clsName.lastIndexOf(".") + 1); }
From source file:Main.java
public static String getUrlFileName(String url) { int slashIndex = url.lastIndexOf('/'); int dotIndex = url.lastIndexOf('.'); String filenameWithoutExtension; if (dotIndex == -1) { filenameWithoutExtension = url.substring(slashIndex + 1); } else {/*from w w w . j av a 2 s.c om*/ filenameWithoutExtension = url.substring(slashIndex + 1, dotIndex); } return filenameWithoutExtension; }
From source file:Main.java
public static String removeExtension(final String path) { final int dot = path.lastIndexOf("."); if (-1 == dot || 0 == dot || dot <= path.lastIndexOf("/") + 1) { return path; } else {/*from w w w . j a v a2 s . com*/ return path.substring(0, dot); } }
From source file:Main.java
private static String getFieldName(String glueField) { return glueField.substring(glueField.lastIndexOf(".") + 1); }
From source file:Main.java
public static String extractFilePath(String _sFilePathName) { int nPos = _sFilePathName.lastIndexOf('/'); if (nPos < 0) { nPos = _sFilePathName.lastIndexOf('\\'); }/*w ww . j a v a 2s. c o m*/ return (nPos >= 0 ? _sFilePathName.substring(0, nPos + 1) : ""); }