List of usage examples for java.lang String indexOf
public int indexOf(String str)
From source file:Main.java
private static String parseContentDisposition(String contentDisposition) { int index = contentDisposition.indexOf("="); if (index > 0) { return contentDisposition.substring(index + 1); }//from w w w . ja v a 2s . c o m return null; }
From source file:Main.java
public static String getBeforeSeparatorOrAll(String name) { int index = name.indexOf(SEPARATOR); if (index == -1) return name; return name.substring(0, index); }
From source file:Main.java
public static String getFileExt(String url) { if (url.indexOf("?") > -1) { url = url.substring(0, url.indexOf("?")); }//ww w .j av a 2 s . co m if (url.lastIndexOf(".") == -1) { return null; } else { String ext = url.substring(url.lastIndexOf(".")); if (ext.indexOf("%") > -1) { ext = ext.substring(0, ext.indexOf("%")); } if (ext.indexOf("/") > -1) { ext = ext.substring(0, ext.indexOf("/")); } return ext.toLowerCase(); } }
From source file:Main.java
/** * Strip the anchor link from a url/*w w w . j a v a 2 s .c o m*/ * * @param url * @return */ public static String stripAnchor(String url) { int anchorIndex = url.indexOf('#'); if (anchorIndex > 0) { return url.substring(0, anchorIndex); } else { return url; } }
From source file:Main.java
public static String fileTitle(String file) { String s = new File(file).getName(); return s.indexOf(".") == -1 ? s : s.substring(0, s.indexOf(".")); }
From source file:Main.java
public static void latencyLog(String data) { data = data.substring(data.indexOf("time-") + 5); long started = Long.parseLong(data); long current = System.currentTimeMillis(); Log.i("Latency", String.valueOf(current - started)); }
From source file:Main.java
/** * Method to find out whether an expression is of XPath nature or custom dot notation syntax. * @param expression the expression string to check. * @return boolean the result.//from w w w. j a v a 2 s.co m */ public static boolean isXPathExpression(String expression) { return expression.indexOf('/') != (-1) || expression.indexOf('(') != (-1); }
From source file:Main.java
public static String getFileName(String path) { int index = path.lastIndexOf("/") + 1; String tmp = path.substring(index); if (tmp.indexOf("?") > -1) { tmp = tmp.substring(0, tmp.indexOf("?")); }//from w w w . ja va 2 s.co m return tmp; }
From source file:Main.java
private static boolean isWindowsMobile(String userAgent) { return userAgent.indexOf(WINDOWS_PHONE_7) != -1 || userAgent.indexOf(WINDOWS_MOBILE) != -1 || userAgent.indexOf(WINDOWS_IE_MOBILE) != -1; }
From source file:Main.java
/** * Get the path of a given uri, removing the scheme and authority parts *//*from w w w . j a v a 2s .co m*/ public static String getUriPath(String uri) { int idx = uri.indexOf("://"); int idx2 = uri.indexOf('/', idx + 3); return uri.substring(idx2 + 1); }