List of usage examples for java.lang String indexOf
public int indexOf(String str)
From source file:Main.java
public static void isLegalHttpUrl(String url) { int idx = url.indexOf("://"); if (idx == -1) { throw new IllegalArgumentException(url + " is not an right http url,no '://'"); }// w ww . ja va2 s. c o m if (!url.startsWith("http")) { throw new IllegalArgumentException(url + " is not an right http url,no \"http\""); } }
From source file:Main.java
/** * Append string literal in XPath context. * * @param xpath StringBuilder for building XPath. * @param s string literal.//from ww w . java 2s. c o m */ public static void appendStringLiteral(StringBuilder xpath, String s) { if (s.indexOf('"') >= 0) { if (s.indexOf('\'') >= 0) xpath.append("concat(\"").append(s.replace("\"", "\",'\"',\"")).append("\")"); else xpath.append('\'').append(s).append('\''); } else { xpath.append('"').append(s).append('"'); } }
From source file:Main.java
private static String getName(String str) { int space = str.indexOf(' '); if (space > 0) return str.substring(0, space); else/*from w ww . j a v a 2 s. com*/ return str; }
From source file:Main.java
private static String updateFormat(String dateTime) { if (dateTime.indexOf('y') == dateTime.lastIndexOf('y')) { dateTime = dateTime.replace("y", "yyyy"); }// www .j a v a 2 s. c om return dateTime; }
From source file:Main.java
/** * Return the fragment portion of a URI string (i.e. everything after a #). * @param uri a uri string//from w w w.j a v a 2s.c o m * @return the fragment or original uri if no # present */ public static String getFragmentFromURI(String uri) { if (uri.indexOf('#') > 0) { return uri.substring(uri.indexOf('#') + 1); } return uri; }
From source file:Main.java
private static int readLineNumber(String line) { int start = line.indexOf("line="); //$NON-NLS-1$ return Integer.valueOf(line.substring(start + 5)); }
From source file:Main.java
private static String extractEncoding(String hdr) { int i = hdr.indexOf("encoding="); //$NON-NLS-1$ if (i == -1)// w w w . j a va 2s . c o m return null; hdr = hdr.substring(i + 9); char sep = hdr.charAt(0); hdr = hdr.substring(1); i = hdr.indexOf(sep); if (i == -1) return null; return hdr.substring(0, i); }
From source file:Main.java
private static boolean isAxelNS(String ns) { if (ns.indexOf("uxml.net") >= 0 || ns.indexOf("xmlactions.org") >= 0 || ns.indexOf("jdhtml.com") >= 0 || ns.indexOf("riostl") >= 0) { return true; }/*from w ww.j a va2 s . com*/ return false; }
From source file:Main.java
private static boolean isJarReference(String name) { return name.indexOf("!/") != -1; }
From source file:Main.java
public static boolean isRemotePath(String path) { if (path != null && path.indexOf("http://") > -1) { return true; }/*w w w.j av a 2 s . c om*/ return false; }