List of usage examples for java.lang String lastIndexOf
public int lastIndexOf(String str)
From source file:Main.java
/** * Get parent path of file/*from w w w.j a va 2 s. c om*/ * * @param p_absoluteFilename * The file name with absolute path * @return String Parent path * * @version 1.0 * @since 8.2.2 */ private static String getBaseAbsoluatePath(String p_absoluteFilename) { return p_absoluteFilename.substring(0, p_absoluteFilename.lastIndexOf(File.separator)); }
From source file:Main.java
public static String getThumbnailImagePath(String thumbRemoteUrl) { String thumbImageName = thumbRemoteUrl.substring(thumbRemoteUrl.lastIndexOf("/") + 1, thumbRemoteUrl.length());// w w w. ja v a2 s .c o m /* String path = PathUtil.getDbManager().getImagePath() + "/" + "th" + thumbImageName; EMLog.d("msg", "thum image path:" + path);*/ return null; }
From source file:Main.java
/** * Convenience method for retrieving a subset of the UIDefaults pertaining to a particular class. * /*ww w . jav a 2 s . c o m*/ * @param clazz * the class of interest * @return the UIDefaults of the class */ public static UIDefaults getUIDefaultsOfClass(Class<?> clazz) { String name = clazz.getName(); name = name.substring(name.lastIndexOf(".") + 2); //$NON-NLS-1$ return getUIDefaultsOfClass(name); }
From source file:Main.java
public static File getAudioFile(Context context, String url) { String fileName = url.substring(url.lastIndexOf("/") + 1); String path = getOutputAudioPath(context, fileName); if (TextUtils.isEmpty(path)) { return null; } else {/*from w ww .ja v a 2 s .co m*/ return new File(path); } }
From source file:Main.java
public static String formatImageUri(String originUri, String pre) { try {/*from www .ja va 2 s . c o m*/ if (originUri == null) { return originUri; } String origin = originUri.replaceAll("!.*\\?", "?"); int index = origin.lastIndexOf('?'); if (index < 0) { return origin; } String p1 = origin.substring(0, index); String p2 = origin.substring(index); return p1 + pre + p2; } catch (Throwable e) { } return originUri; }
From source file:Main.java
public static String getFileFormat(String path) { if (path == null) { return ""; }//from w w w . ja v a2 s. c o m int i = path.lastIndexOf("."); if (i < 0) { return path; } return path.substring(i + 1); }
From source file:Main.java
public static String getBaseType(String typeName) { String ret = typeName.substring(typeName.lastIndexOf('.') + 1); return ret.replace("[]", ""); }
From source file:Main.java
/** * change "'aaaa'" to "aaaa"/*from w w w . j a v a2 s. c o m*/ * * @param str * @return */ public static String removeSingleQuote(String str) { return str.substring(str.indexOf('\'') + 1, str.lastIndexOf('\'')); }
From source file:Main.java
/** * Returns an unqualified version of the given file path. *//*from w ww .j a v a2 s . com*/ private static String unqualify(String path) { path = path.replace('\\', '/'); return path.substring(path.lastIndexOf('/') + 1); }
From source file:Main.java
/** * Remove unnecessary zeros after the decimal point, e.g. "12.000" becomes "12". *//* w w w. j a v a2 s.c om*/ private static String stripZeros(String s) { int index = s.lastIndexOf('.'); if (index == -1) return s; for (int i = index + 1; i < s.length(); i++) { char c = s.charAt(i); if (c != '0') return s; } return s.substring(0, index); }