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:com.netflix.spinnaker.fiat.model.resources.ResourceType.java

public static ResourceType parse(@NonNull String pluralOrKey) {
    if (pluralOrKey.contains(":")) {
        pluralOrKey = StringUtils.substringAfterLast(pluralOrKey, ":");
    }/*w w w .  ja va2 s .  co m*/
    String singular = StringUtils.removeEnd(pluralOrKey, "s");
    return ResourceType.valueOf(singular.toUpperCase());
}

From source file:Main.java

/**
 * Checks if a node name equals a particular name, regardless of prefix.
 * NOTE: If checking names containing subsets of others using case or if else statements,
 *        start with one which is not contained by others. 
 *       e.g "itemset" should be before "item".
 * //  ww  w.  j a va 2s .  c om
 * @param nodeName the node name.
 * @param name the name to compare with.
 * @return true if they are the same, else false.
 */
public static boolean nodeNameEquals(String nodeName, String name) {
    return nodeName.equals(name) || nodeName.contains(":" + name);

}

From source file:Main.java

public static boolean checkRootMethod1() {
    String buildTags = android.os.Build.TAGS;

    if (buildTags != null && buildTags.contains("test-keys")) {
        return true;
    }//from  w  ww.  j a  v a 2 s .co m
    return false;
}

From source file:Main.java

/**
 * Checks if the specified id is a single-valued id or a template for multiple id-s.
 *
 * @param nodeId/*from ww  w . j  av a2s . co  m*/
 *            The id to examine
 * @return true if this id is a template, false if it's a single-values id.
 */
private static boolean isIdTemplate(final String nodeId) {
    boolean result = false;

    if (nodeId.contains("{0}")) {
        result = true;
    }

    return result;
}

From source file:Main.java

/**
 * http://36kr.com/p/5040401.html-->5040401
 * @param pStr/*from ww  w . ja v a  2  s.c  o m*/
 * @return
 */
public static String getArticleId(String pStr) {
    String tempStr = pStr.substring(pStr.lastIndexOf("/") + 1);
    if (tempStr.contains(".")) {
        String[] temp = tempStr.split("\\."); //  5040196
        return temp[0];
    }
    return pStr;
}

From source file:com.aqnote.app.wifianalyzer.vendor.model.VendorNameUtils.java

static String cleanVendorName(String name) {
    if (StringUtils.isBlank(name) || name.contains("<") || name.contains(">")) {
        return StringUtils.EMPTY;
    }/* ww  w.  j a  v a  2  s  .c o m*/
    String result = name.replaceAll("[^a-zA-Z0-9]", " ").replaceAll(" +", " ").trim().toUpperCase();

    return result.substring(0, Math.min(result.length(), VENDOR_NAME_MAX));
}

From source file:mongodb.MongoUtils.java

public static Object getValue(Document doc, String attribut) {
    if (!attribut.contains("."))
        return doc.get(attribut);
    else {// w w w .  ja  v  a  2s.c  o  m
        //System.out.println("Attribut a splitter : ["+attribut+"]");
        String[] parties = attribut.split("\\.");
        Document nested = (Document) doc.get(parties[0]);

        return getValue(nested, StringUtils.join(Arrays.copyOfRange(parties, 1, parties.length), "."));
    }
}

From source file:Main.java

public static boolean isNumeric(String operand) {
    operand = operand.toUpperCase();/*from w  w w  . j  av  a  2  s.  co  m*/
    if (operand.contains("0X")) {
        return operand.matches("0[xX][0-9a-fA-F]+");
    }
    if (operand.contains("H")) {
        return operand.matches("\\d+[h|H]+");
    }

    return operand.matches("\\d+");

}

From source file:Main.java

public static String getUriName(String uri) {
    if (!TextUtils.isEmpty(uri)) {
        if (uri.contains("/")) {
            int index = uri.lastIndexOf("/");
            if (index < uri.length() - 2) {
                uri = uri.substring(index + 1, uri.length());
            }//from   w w w .ja  va  2 s  .c  o  m
        }
    }
    return uri;
}

From source file:Main.java

private static boolean isContainAny(String in, String[] strArr) {
    for (String str : strArr) {
        if (in.contains(str.toLowerCase()))
            return true;
    }//from w ww .j a  v a 2s .c  o m
    return false;
}