List of usage examples for java.lang String endsWith
public boolean endsWith(String suffix)
From source file:Main.java
private static boolean isPxVal(String val) { if (val.endsWith("px")) { return true; }// w w w .j a v a 2 s . c o m return false; }
From source file:Main.java
private static boolean isWrapped(String s) { return s.startsWith("(") && s.endsWith(")"); }
From source file:Main.java
/** * @return An explicit MIME data type.// w w w . ja v a2 s . com */ public static String getMIMEType(String file_name) { if (file_name.endsWith(".txt")) { return "text/plain"; } else if (file_name.endsWith(".apk")) { return "application/vnd.android.package-archive"; } else { return "*/*"; } }
From source file:Main.java
private static String removeSlashInStartAndAddAtTheEndOfBaseDir(String baseDir) { baseDir = baseDir.endsWith("/") ? baseDir : baseDir + "/"; while (baseDir.startsWith("/") || baseDir.startsWith("./")) { baseDir = baseDir.startsWith("/") ? baseDir.substring(1) : baseDir; baseDir = baseDir.startsWith("./") ? baseDir.substring(2) : baseDir; }/*from w w w.j ava 2 s . c om*/ return baseDir; }
From source file:Main.java
private static String combineInternal(String path1, String path2) { if (path1.endsWith("/") && path2.startsWith("/")) { return path1 + path2.substring(1, path2.length()); } else {/*from w ww . j av a 2 s . c om*/ return path1 + path2; } }
From source file:Main.java
public static String makePath(String path1, String path2) { if (path1.endsWith(File.separator)) return path1 + path2; return path1 + File.separator + path2; }
From source file:Main.java
/** * Normalizes the namespace./* w w w .ja v a 2 s . c o m*/ * * @param namespace the namespace to normalize. * @return normalized namespace. */ private static String normalizeNamespace(String namespace) { if (namespace.endsWith("/")) { return namespace.substring(0, namespace.length() - 1); } return namespace; }
From source file:Main.java
static String getCorePkgsArch(final String arch) { if (arch.endsWith("i386")) return "i686-pc-linux-gnu"; else if (arch.startsWith("armhf")) return "arm-linux-gnueabihf"; else if (arch.endsWith("amd64")) return "x86_64-linux-gnu"; else if ("arm64".equals(arch)) return "aarch64-linux-gnu"; return null;/*from ww w . j a v a 2s . c o m*/ }
From source file:Main.java
/** * Returns true if {@code fileName} names a .zip, .jar, or .apk. */// w w w . ja va 2 s . co m public static boolean hasArchiveSuffix(String fileName) { return fileName.endsWith(".zip") || fileName.endsWith(".jar") || fileName.endsWith(".apk"); }
From source file:Main.java
public static boolean isPossibleSpoofClient(String peer_id) { return peer_id.endsWith("UDP0") || peer_id.endsWith("HTTPBT"); }