List of usage examples for java.lang String endsWith
public boolean endsWith(String suffix)
From source file:Main.java
public static boolean isM4AFile(String in) { in = in.toLowerCase(Locale.US); return in.endsWith(".m4a") || in.endsWith(".m4p"); }
From source file:Main.java
private static void createDestDirectoryIfNecessary(String destParam) { File destDir = null;/*from ww w . j a v a 2 s. c om*/ if (destParam.endsWith(File.separator)) { destDir = new File(destParam); } else { destDir = new File(destParam.substring(0, destParam.lastIndexOf(File.separator))); } if (!destDir.exists()) { destDir.mkdirs(); } }
From source file:Main.java
private static boolean isPlainText(String fileFullName) { boolean isPlainText = false; if (fileFullName.endsWith(".json") || fileFullName.endsWith(".gs")) { isPlainText = true;/* w w w . j a v a 2s . c o m*/ } return isPlainText; }
From source file:Main.java
private static boolean isPlainText(String fileFullName) { boolean isPlainText = false; if (fileFullName.endsWith(".json")) { isPlainText = true;/*from w w w . j a va2 s . c o m*/ } return isPlainText; }
From source file:Main.java
private static boolean isImage(String filePath) { filePath = filePath.toLowerCase();//from w w w . ja va 2 s .com return filePath.endsWith(".png") || filePath.endsWith(".jpg") || filePath.endsWith(".jpeg") || filePath.endsWith(".gif"); }
From source file:Main.java
/** * Check if object is expression base on altSyntax * * @param value to treat as an expression * @return true if it is an expression/* www.j a v a2s . com*/ */ public static boolean isExpression(Object value) { String expr = value.toString(); return expr.startsWith("%{") && expr.endsWith("}"); }
From source file:Main.java
private static Set<File> getExpectationFiles(String dir) { Set<File> expectSet = new HashSet<File>(); File[] files = new File(dir).listFiles(new FilenameFilter() { // ignore obviously temporary files public boolean accept(File dir, String name) { return !name.endsWith("~") && !name.startsWith("."); }//from w w w.j a v a 2s.c om }); if (files != null) { expectSet.addAll(Arrays.asList(files)); } return expectSet; }
From source file:Main.java
/** * Parses a percentage and returns a scaled float. * @param s contains the number to parse. * @return a float scaled number. 1.0 represents 100%. * @throws NumberFormatException if the number format is invalid or does not end with '%'. *///from www . jav a2 s.com public static float parsePercentage(String s) throws NumberFormatException { if (!s.endsWith("%")) { throw new NumberFormatException("Percentages must end with %"); } return Float.parseFloat(s.substring(0, s.length() - 1)) / 100; }
From source file:Main.java
public static String getParent(String path) { if (TextUtils.equals("/", path)) return path; String parentPath = path; if (parentPath.endsWith("/")) parentPath = parentPath.substring(0, parentPath.length() - 1); int index = parentPath.lastIndexOf('/'); if (index > 0) { parentPath = parentPath.substring(0, index); } else if (index == 0) parentPath = "/"; return parentPath; }
From source file:gr.aueb.dmst.istlab.unixtools.util.EclipsePluginUtil.java
private static boolean path(String value) { return value.endsWith("\\") || value.endsWith("/"); }