Example usage for java.lang String startsWith

List of usage examples for java.lang String startsWith

Introduction

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

Prototype

public boolean startsWith(String prefix) 

Source Link

Document

Tests if this string starts with the specified prefix.

Usage

From source file:Main.java

public static String getGeneralField(String methodNameWithGet) {
    if (methodNameWithGet.startsWith("get") || methodNameWithGet.startsWith("set")) {
        return cutPreAndLowerFirst(methodNameWithGet, 3);
    }//from ww w.j  a v a  2s .c  o  m
    return null;
}

From source file:Main.java

/**
 * @param s/*from  w w w. j  a v  a  2s .  c o m*/
 * @return   unwrapped text
 */
public static String unwrapCdata(String s) {
    return (s.startsWith("<![CDATA[") && s.endsWith("]]>")
            ? s.substring(9, s.length() - 3).replace("]]]]><![CDATA[>", "]]>")
            : s);
}

From source file:Main.java

private static String getMethodNameMinusGet(Method aMethod) {
    String result = aMethod.getName();
    if (result.startsWith(fGET)) {
        result = result.substring(fGET.length());
    }/*from   w  w w  . j  av  a  2s  .com*/
    return result;
}

From source file:Main.java

public static Map<String, Object> getProperties(Map<String, Object> map) {
    Map<String, Object> propertiesMap = new HashMap<String, Object>();
    for (String key : map.keySet()) {
        if (!key.startsWith("__")) {
            propertiesMap.put(key, map.get(key));
        }/*from w w w  .j  ava  2  s  .  c om*/
    }
    return propertiesMap;
}

From source file:Main.java

private static boolean isLocalPath(String path) {
    return !TextUtils.isEmpty(path) && !path.startsWith("http");
}

From source file:Main.java

public static String removeXPathNamespaceDeclarations(String xpath) {
    while (xpath.startsWith("declare namespace")) {
        int ix = xpath.indexOf(';');
        if (ix == -1)
            break;

        xpath = xpath.substring(ix + 1).trim();
    }/* w  w  w  .ja  v  a 2s. c  om*/
    return xpath;
}

From source file:Main.java

public static String removePrefix(String str, String prefix) {
    if (str != null && str.startsWith(prefix)) {
        return str.substring(prefix.length());
    }/*  w ww.  j av  a2 s  .c  om*/
    return str;
}

From source file:Main.java

public static String getDeviceModelName() {
    String manufacturer = Build.MANUFACTURER;
    String model = Build.MODEL;
    if (model.startsWith(manufacturer)) {
        return capitalize(model);
    } else {/*from   www . ja  va  2  s . c  o  m*/
        return capitalize(manufacturer) + " " + model;
    }
}

From source file:Main.java

public static boolean enclosed(String line, String s) {
    return line.startsWith(s) && line.endsWith(s);
}

From source file:Main.java

public static boolean isXML(final String s) {
    return s != null && (s.startsWith("<?xml") || s.startsWith("<"));
}