List of usage examples for java.lang String endsWith
public boolean endsWith(String suffix)
From source file:Main.java
public static boolean isPicure(String path) { if (path.endsWith(".png") || path.endsWith(".PNG") || path.endsWith(".jpg") || path.endsWith(".JPG") || path.endsWith(".jpeg") || path.endsWith(".JPEG")) { return true; } else {/* ww w . jav a 2 s .c o m*/ return false; } }
From source file:Main.java
public static String getFolderNameOfPath(String path) { if (path.endsWith("/")) path = path.substring(0, path.length() - 1); int index = path.lastIndexOf('/'); if (index == -1 || index == 0) return path; return path.substring(index + 1); }
From source file:Main.java
public static String stripDash(String source) { if (source.endsWith("-")) { return source.substring(0, source.length() - 1); } else {/*from www.j a v a2 s . c o m*/ return source; } }
From source file:Main.java
public static boolean isVideo(String file) { if (file.endsWith("mp4")) return true; return false; }
From source file:Main.java
/** * Ensures that a filename never ends with the file name extension ".xml" * @param name//from w w w. ja v a 2 s. c o m * @return */ public static String getFileNameWithoutExtension(String name) { if (name.endsWith(".xml") || name.endsWith(".txt")) { name = name.substring(0, name.length() - 4); } return name; }
From source file:Main.java
public static String appendSlash(String definitions) { return definitions.endsWith(File.separator) ? definitions : definitions + File.separator; }
From source file:Main.java
/** * @author vshetty2/* w ww .j a v a2 s .com*/ * * Mar 17, 2016 */ private static String removelastcommachar(String _str) { if (_str.endsWith(",")) { return _str.substring(0, _str.length() - 1); } else { return _str; } }
From source file:Main.java
public static boolean isAudio(String fileName) { if (fileName.endsWith(".amr")) { return true; } else {//from ww w . ja v a2 s .co m return false; } }
From source file:Main.java
public static String assertSlash(final String ofString) { if (ofString.endsWith("/")) return ofString; return ofString.concat("/"); }
From source file:Main.java
public static boolean isApp(String url) { return url.endsWith(".exe") || url.endsWith(".bin") || url.endsWith(".bat") || url.endsWith(".dmg"); }