Example usage for java.lang String contains

List of usage examples for java.lang String contains

Introduction

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

Prototype

public boolean contains(CharSequence s) 

Source Link

Document

Returns true if and only if this string contains the specified sequence of char values.

Usage

From source file:Main.java

public static String stripNumberFormatiing(String string) {

    if (string.contains("(")) {
        string = string.replaceAll("[^0-9]", "");
    }//from   ww w.  j  a  va2  s  . c om
    return string;
}

From source file:Main.java

public static String getTitleId(String pStr) {
    if (pStr.contains(".")) {
        String[] temp = pStr.split("\\."); //  /p/5040196
        int index = temp[0].lastIndexOf("/");
        return temp[0].substring(index + 1);
    }/*from  ww  w  .  j a  v a 2 s .c  o m*/
    return pStr;
}

From source file:Main.java

public static String removeDashFromString(String str) {

    while (str.contains("-")) {
        str = str.substring(0, str.indexOf('-')) + str.substring(str.indexOf('-') + 1, str.length());
    }/*from  w  w  w. jav a 2s  . c o  m*/
    return str;
}

From source file:Main.java

public static String deparseText(String text) {
    if (text.contains(TAG_OPEN)) {
        return text.replace(TAG_OPEN, "").replace(TAG_CLOSE, "");
    }//from w  w  w .  j  ava2 s .c o m

    return text;
}

From source file:Main.java

public static boolean isGPSCoordinate(String coords) {
    return coords.contains("&") || ICAO_GPS_PATTERN.matcher(coords).matches();
}

From source file:Main.java

public static String replacePlusWithPercent20(String url) {
    if (url.contains("+")) {
        url = PATTERN_PLUS.matcher(url).replaceAll("%20");
    }//from www . jav a2 s  . c om
    return url;
}

From source file:Main.java

public static boolean notWorthCompressing(String contentType) {
    return contentType.contains("jpeg") || contentType.contains("pdf") || contentType.contains("zip")
            || contentType.contains("mpeg") || contentType.contains("avi");
}

From source file:Main.java

public static boolean containsList(String attributePath) {
    return attributePath.contains("[");
}

From source file:Main.java

public static String splitJidAndServer(String account) {
    if (!account.contains("@"))
        return account;
    String[] res = account.split("@");
    String userName = res[0];//from w w w .j  a  va 2  s. c o  m
    return userName;
}

From source file:Main.java

private static String getClassNameFromPackageName(String className) {
    if (className.contains(".")) {
        String[] classNameArr = className.split("\\.");
        className = classNameArr[classNameArr.length - 1];
    }/*  ww w  . j  ava2 s  .  co  m*/
    return className;
}