List of usage examples for java.lang String contains
public boolean contains(CharSequence s)
From source file:Main.java
public static String changeED2K(String url) { // TODO Auto-generated method stub Pattern pat = Pattern//from w w w .j a va 2s . c o m .compile("ed2k:\\/\\/\\|file\\|([^\\|]+?)\\|(\\d+)\\|([A-Z0-9]{32})\\|(h=[A-Z0-9]{32}\\|)?\\/?"); Matcher mat = pat.matcher(url); // System.out.println(url); if (mat.find()) { String name = "" + mat.group(1); if (name.contains(".")) { String temp = "1" + name.substring(name.lastIndexOf(".")); url = url.replace(name, temp); // System.out.println(url); } } if (url.startsWith("magnet:?xt=urn:btih:") && url.contains("&")) { url = url.substring(0, url.indexOf("&")).toLowerCase(); } return url; }
From source file:Main.java
public static String replaceUrlcode(String str) { Log.e("log", "replaceUrlcode"); if (!str.contains(" ")) return str; //StringBuffer sb = new StringBuffer(str); //int position = str.indexOf("\\+"); //str.split("%20", position); str = str.replaceAll(" ", "%20"); Log.e("log", "replaceUrlcode:" + str); return replaceUrlcode(str); }
From source file:Main.java
/** * Whether the content has been compressed. * * @param contentEncoding read the data from the server's head. * @return True: yes, false: no inclusion. */// w w w . j av a2 s .co m public static boolean isGzipContent(String contentEncoding) { return contentEncoding != null && contentEncoding.contains("gzip"); }
From source file:Main.java
public static String getClientIdFromCertificate(X509Certificate certificate) { if (certificate == null) { throw new IllegalArgumentException("Certificate cannot be null"); }/* ww w. ja va2s .com*/ //subjectDN is of the form: "UID=<clientId>, DC=<some other value>" or "DC=<some other value>, UID=<clientId>" String clientId = null; String subjectDN = certificate.getSubjectDN().getName(); String[] parts = subjectDN.split(Pattern.quote(",")); for (String part : parts) { if (part.contains("UID=")) { String uid = part.substring(part.indexOf("UID=")); clientId = uid.split(Pattern.quote("="))[1]; } } return clientId; }
From source file:Main.java
/** * @param toCheck/* w w w .j av a 2s . c o m*/ * @return */ public static boolean isValidAtom(String toCheck) { String lowerCase = toCheck.toLowerCase(); return !toCheck.contains(" ") && !toCheck.contains(",") && toCheck.equals(lowerCase); }
From source file:Main.java
public static boolean isValidNodePath(String path) { return path != null && path.startsWith("/") && !path.contains("//") && !path.contains("*") && !path.contains("(") && !path.contains(")"); }
From source file:dpfmanager.shell.core.util.VersionUtil.java
private static String replaceLine(String[] lines, String search, String version) { int i = 0;// www. ja v a 2 s .c o m while (i < lines.length) { String line = lines[i]; if (line.contains(search)) { if (line.contains(version)) { System.out.println("No need to change version."); return ""; } lines[i] = search + version; return StringUtils.join(lines, '\n'); } i++; } return ""; }
From source file:Main.java
private static String[] getSingleValue(String rawValue) throws Exception { if (!rawValue.contains("_")) throw new Exception( "Raw value \"" + rawValue + "\" does not appear to be an INX raw value, expected '_'"); // logger.debug("getSingleValue(): raw value=\"" + rawValue + "\""); String[] tokens = rawValue.split("_"); // Should be two tokens if (tokens.length > 2) throw new Exception("Expected two items in tokenzied raw value, got " + tokens.length); if (tokens.length == 1) { // Means value was like "c_", which is valid and indicates and empty string. String[] newTokens = new String[2]; newTokens[0] = tokens[0];/*www. j a v a2 s . com*/ newTokens[1] = ""; tokens = newTokens; } return tokens; }
From source file:Main.java
/** * Check whether the specified class name is a CGLIB-generated class. * * @param className the class name to check *//*from w w w . j a v a 2s . co m*/ public static boolean isCglibProxyClassName(String className) { return (className != null && className.contains(CGLIB_CLASS_SEPARATOR)); }
From source file:Main.java
public static long parseFeedDate(String date) { SimpleDateFormat formatter;/* w w w .j a v a 2 s. c om*/ if (date.contains(" - ")) { date = date.split(" - ")[0].trim(); } formatter = new SimpleDateFormat("d. MMMM yyyy"); Date d = null; try { d = formatter.parse(date); } catch (ParseException e) { e.printStackTrace(); } return d.getTime(); }