Example usage for java.lang String indexOf

List of usage examples for java.lang String indexOf

Introduction

In this page you can find the example usage for java.lang String indexOf.

Prototype

public int indexOf(String str) 

Source Link

Document

Returns the index within this string of the first occurrence of the specified substring.

Usage

From source file:Main.java

public static String extractHash(String data) {
    int i = data.indexOf("::::");
    String hash = data.substring(0, i + "::::".length());
    hash = hash.replace(":", "");
    return hash;/*from w w  w.  java  2  s.c  om*/
}

From source file:Main.java

public static String getFooterFromLocation(String location) {
    if (location.indexOf(",") != -1)
        return location.substring(location.indexOf(",") + 2);
    else//w  w w  .  ja  v a2  s . c om
        return "";
}

From source file:Main.java

private static String removeTag(String xml) {
    int start = xml.indexOf('>') + 1;
    int end = xml.lastIndexOf('<');
    return xml.substring(start, end);
}

From source file:Main.java

private static String delQuot(String s) {
    return s.substring(s.indexOf('"') + 1, s.lastIndexOf('"'));
}

From source file:Main.java

public static Number string2number(final String iText) {
    if (iText.indexOf('.') > -1)
        return Double.parseDouble(iText);
    else/*w  w w  .j av  a2 s.c om*/
        return Long.parseLong(iText);
}

From source file:Main.java

public static boolean isAddressUsingBIP21(String addressString) {
    return addressString.indexOf(":") != -1;
}

From source file:Main.java

public static String getPathRootInPath(String path) {
    int pos = path.indexOf(pathSeparator);
    if (pos >= 0)
        return path.substring(0, pos);
    return path;/*from w w w. j av  a 2  s.c  om*/
}

From source file:Main.java

public static String getNextPathInPath(String path) {
    int pos = path.indexOf(pathSeparator);
    if (pos >= 0)
        return path.substring(pos + 1);
    return path;//  w  ww .j av a2  s . c  om
}

From source file:Utils.java

/**
 * @param uri//  ww w . ja  va 2 s . com
 * @return
 */
static public String eliminateQuery(String uri) {
    int idx = uri.indexOf('?');
    if (idx < 0)
        return uri;
    return uri.substring(0, idx);
}

From source file:Main.java

public static String getExtension(String fileName) {
    int length = fileName.indexOf(".");
    return fileName.substring(length + 1);
}