Example usage for java.lang String toLowerCase

List of usage examples for java.lang String toLowerCase

Introduction

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

Prototype

public String toLowerCase() 

Source Link

Document

Converts all of the characters in this String to lower case using the rules of the default locale.

Usage

From source file:ape.ApeCommand.java

/**
 * This method uses the iterator inside the ServiceLoader class 
 * to get all the options that represents each implementation of ApeCommand
 *///from w  w  w . java  2s.c om
public static ApeCommand getCommand(String cmdname) {
    String name = cmdname.toLowerCase();

    Iterator<ApeCommand> iter = loader.iterator();
    while (iter.hasNext()) {
        ApeCommand ac = iter.next();
        if (name.equals(ac.getName().toLowerCase())) {
            return ac;
        }
    }
    return null;
}

From source file:Main.java

public static String convertStr(String str) {
    String lowerStr = "";
    try {//w w w .  j av  a 2 s  .com
        lowerStr = str.toLowerCase().replace("http://", "");
        lowerStr = lowerStr.substring(lowerStr.indexOf("/"), lowerStr.length());
        return lowerStr.replace("/", "").replace("images", "").replace("image", "").replace(":", "")
                .replace(".", "").replace("-", "").replace("jpg", "").replace("png", "").toUpperCase().trim()
                + CACHESUFFIX;
    } catch (Exception e) {
        lowerStr = "cachetemp" + CACHESUFFIX;
    }
    return lowerStr;
}

From source file:Main.java

static public String getValueFirstTag(String text, String tag) {
    String id = "";
    int idx_s = text.toLowerCase().indexOf("<" + tag.toLowerCase() + ">");
    int idx_e = text.toLowerCase().indexOf("</" + tag.toLowerCase() + ">");
    if ((idx_s > -1) && (idx_e > idx_s)) {
        id = text.substring(idx_s + tag.length() + 2, idx_e).trim();
    }/* w  w w .j  av  a  2 s.  com*/
    return id;
}

From source file:com.us.data.ContentTypeProcesser.java

/**
 * ?//from  w  w w  . j a v  a  2  s . c om
 * 
 * @param key
 * @return
 */
public static String findType(String key) {
    Object type = ALL_TYPES.get(key.toLowerCase());
    if (type != null)
        return type.toString();
    return "";
}

From source file:Main.java

/**
 * Check of the balanced tags sup/sub//from w  w  w . ja  v  a 2s  .c  om
 * 
 * @param snippet
 * @return <code>true</code> if balanced, <code>false</code> otherwise
 */
public static boolean isBalanced(String snippet) {
    if (snippet == null)
        return true; // ????

    Stack<String> s = new Stack<String>();
    Matcher m = SUBS_OR_SUPS.matcher(snippet);
    while (m.find()) {
        String tag = m.group(1);
        if (tag.toLowerCase().startsWith("su")) {
            s.push(tag);
        } else {
            if (s.empty() || !tag.equals("/" + s.pop())) {
                return false;
            }
        }
    }

    return s.empty();
}

From source file:Main.java

private static boolean isYunOS() {
    try {/*from w w  w  .j a  v  a 2s . c  o m*/
        String version = System.getProperty("ro.yunos.version");
        String vmName = System.getProperty("java.vm.name");
        return (vmName != null && vmName.toLowerCase().contains("lemur"))
                || (version != null && version.trim().length() > 0);
    } catch (Exception ignore) {
        return false;
    }
}

From source file:Main.java

/**
 * Converts a string that contains upper-case letter and underscores (e.g.,
 * constant names) to a camel-case string. For example, MY_CONSTANT is converted
 * to myConstant./*w w w .ja  va2 s  .  com*/
 * 
 * @param text the string to convert
 * 
 * @return a camel-case version of text
 */
public static String convertAllCapsToLowerCamelCase(String text) {
    String lowerCase = text.toLowerCase();
    while (true) {
        int i = lowerCase.indexOf('_');
        if (i < 0) {
            break;
        }
        String head = lowerCase.substring(0, i);
        if (i + 1 == lowerCase.length()) {
            lowerCase = head;
            break;
        } else {
            char charAfterUnderscore = lowerCase.charAt(i + 1);
            char upperCase = Character.toUpperCase(charAfterUnderscore);
            if (i + 2 < lowerCase.length()) {
                String tail = lowerCase.substring(i + 2, lowerCase.length());
                lowerCase = head + upperCase + tail;
            } else {
                lowerCase = head + upperCase;
                break;
            }
        }
    }
    return lowerCase;
}

From source file:Main.java

@SuppressLint("DefaultLocale")
public static boolean isRotationSupported(String mimeType) {
    if (mimeType == null)
        return false;
    mimeType = mimeType.toLowerCase();
    return mimeType.equals("image/jpeg");
}

From source file:Main.java

@SuppressLint("DefaultLocale")
public static boolean isSupportedByRegionDecoder(String mimeType) {
    if (mimeType == null)
        return false;
    mimeType = mimeType.toLowerCase();
    return mimeType.startsWith("image/") && (!mimeType.equals("image/gif") && !mimeType.endsWith("bmp"));
}

From source file:Main.java

private static String lowerCaseAttributes(String formatted) {
    Matcher m = ID_PATTERN.matcher(formatted);
    StringBuffer sb = new StringBuffer();
    while (m.find()) {
        String text = m.group();
        m.appendReplacement(sb, Matcher.quoteReplacement(text.toLowerCase()));
    }/*from w  ww .j a v a  2s .com*/
    m.appendTail(sb);
    return sb.toString();
}