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 getLocalName(String qName) {
    int colonIndex = qName.indexOf(":");
    if (colonIndex != -1) {
        return qName.substring(colonIndex + 1);
    }/*  w  w w.  ja va2 s.  c o m*/
    return qName;
}

From source file:Main.java

public static String getPrefix(String qName) {
    int colonIndex = qName.indexOf(":");
    if (colonIndex != -1) {
        return qName.substring(0, colonIndex);
    }//w  w  w.j  ava2  s.  c o  m
    return qName;
}

From source file:Main.java

public static int estraiCodice(String string) {
    int index = string.indexOf("-");
    if (index != -1) {
        string = string.substring(0, index - 1);
        return Integer.parseInt(string);
    }//from   w  w w .  j av a 2 s.c  om
    return 0;

}

From source file:Main.java

public static String forAppDate(String date) {
    return date.substring(0, date.indexOf("T")).replace("-", "/");
}

From source file:Main.java

public static String localNameFromQName(String qName) {
    final int colonIndex = qName.indexOf(':');
    return (colonIndex == -1) ? qName : qName.substring(colonIndex + 1);
}

From source file:Main.java

public static String getHttpReqPath(String str) {
    int index = str.indexOf("?");
    if (index > -1) {
        str = str.substring(0, index);/*w  w  w  . j  av a2 s . co m*/
    }
    index = str.indexOf("#");
    if (index > -1) {
        str = str.substring(0, index);
    }
    return str;
}

From source file:Main.java

public static String prefixFromQName(String qName) {
    final int colonIndex = qName.indexOf(':');
    return (colonIndex == -1) ? "" : qName.substring(0, colonIndex);
}

From source file:Main.java

public static String getLugarDesarrollo(String source) {
    int first = source.indexOf("(");
    int last = source.indexOf(")");
    if (first != -1 && last != -1) {
        return source.substring(first + 1, last);
    } else {/*from   ww  w. j  av  a  2  s  .c o  m*/
        return source;
    }
}

From source file:Main.java

public static String getPName(String nameWithStatus) {
    int end = nameWithStatus.indexOf('[');
    if (end > 0)
        return nameWithStatus.substring(0, end);
    return "";
}

From source file:Main.java

public static String getFileExtension(String url) {
    if ((url != null) && (url.indexOf('.') != -1)) {
        return url.substring(url.lastIndexOf('.') + 1);
    }/*from  www  .ja  v  a2  s  .  co m*/
    return "";
}