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:com.gargoylesoftware.htmlunit.FormEncodingType.java

/**
 * Returns the constant that matches the specified name.
 *
 * @param name the name to search by// w  w  w.  j a  v a  2s .co m
 * @return the constant corresponding to the specified name, {@link #URL_ENCODED} if none match.
 */
public static FormEncodingType getInstance(final String name) {
    final String lowerCaseName = name.toLowerCase();

    if (MULTIPART.getName().equals(lowerCaseName)) {
        return MULTIPART;
    }

    return URL_ENCODED;
}

From source file:Main.java

/**
 * Determines if a substring in an array of strings is present in at least one string of that
 * array. String substring is the substring to search for.
 * /* w w w .  ja  v  a 2  s  .  c  o m*/
 * @param list The list of elements to use
 * @param substring The substring to search for in the list
 * @param caseinsensitive If true, ignore upper/lowercase distinctions.
 * 
 * @return boolean True if we found a matching substring in the specified list.
 * 
 */

public static boolean listElementContains(String[] list, String substring, boolean caseinsensitive) {
    if (caseinsensitive) {
        substring = substring.toLowerCase();
        for (String s : list)
            if (s.toLowerCase().contains(substring))
                return true;
        return false;
    } else {
        for (String s : list)
            if (s.contains(substring))
                return true;
        return false;
    }
}

From source file:Main.java

/**
 * Creates a string with the given high intensity foregroundcolor
 * and the given backgroundcolor.//from  www .ja  v a 2 s .c o m
 *
 * @param str String to be colorized.
 * @param fgc Constant defined color (see constants). Will be bold textcolor.
 * @param bgc Constant defined color (see constants). Will be backgroundcolor.
 * @return String with internal markup-sequences.
 */
public static String boldcolorizeText(String str, String fgc, String bgc) {
    return INTERNAL_MARKER + BOLD + INTERNAL_MARKER + fgc + INTERNAL_MARKER + bgc.toLowerCase() + str
            + INTERNAL_MARKER + RESET_ALL;
}

From source file:Main.java

private static String removePrefix(String s) {
    if (s.length() <= IGNORE_PREFIX.length()) {
        return s;
    }// ww w .j a v a  2 s .  c  o m
    if (s.toLowerCase().startsWith(IGNORE_PREFIX.toLowerCase())) {
        return s.substring(IGNORE_PREFIX.length());
    }
    return s;
}

From source file:Main.java

public static String stripRoot(String filename) {
    File[] roots = File.listRoots();
    for (int i = 0; i < roots.length; i++) {
        if (filename.toLowerCase().startsWith(roots[i].toString().toLowerCase()))
            return filename.substring(roots[i].toString().length());
    }/*from  ww  w.  j  a  v a  2s.c om*/
    return filename;
}

From source file:jQuery.PRIMO.Record.java

/**
 * Gets record ext./*www. ja  v a 2s . c o  m*/
 *
 * @param data blob of data
 * @return the record ext
 */
public static String getRecordExt(String data) {
    return data.substring(data.toLowerCase().lastIndexOf(".") + 1);
}

From source file:Main.java

/**
 * @param xpath// ww  w.jav a2 s. c om
 *            The xpath expression.
 * @return the xpath expression for only the element location. Leaves out the attributes and
 *         text()
 */
public static String stripXPathToElement(String xpath) {
    String xpathStripped = xpath;

    if (!Strings.isNullOrEmpty(xpathStripped)) {
        if (xpathStripped.toLowerCase().contains("/text()")) {
            xpathStripped = xpathStripped.substring(0, xpathStripped.toLowerCase().indexOf("/text()"));
        }
        if (xpathStripped.toLowerCase().contains("/comment()")) {
            xpathStripped = xpathStripped.substring(0, xpathStripped.toLowerCase().indexOf("/comment()"));
        }
        if (xpathStripped.contains("@")) {
            xpathStripped = xpathStripped.substring(0, xpathStripped.indexOf("@") - 1);
        }
    }

    return xpathStripped;
}

From source file:Main.java

public static boolean isImage(String filePath) {
    if (TextUtils.isEmpty(filePath)) {
        return false;
    }/*from w  ww .ja va2  s. co m*/

    filePath = filePath.toLowerCase();
    if ((!filePath.endsWith(".jpg") && !filePath.endsWith(".jpeg") && !filePath.endsWith(".png")
            && !filePath.endsWith(".bmp") && !filePath.endsWith(".gif"))) {
        return false;
    }
    return true;
}

From source file:AtkinsonHash.java

public static int hash(String password) {
    try {/*from  w  ww. j  a va  2s  . co m*/
        return hash(password.toLowerCase().getBytes("MACROMAN"));
    } catch (UnsupportedEncodingException uee) {
        return hash(password.toLowerCase().getBytes());
    }
}

From source file:dbs_project.util.TestTableBuilder.java

private static String getFileNameFromTableName(String tableName) {
    return "/data/" + tableName.toLowerCase() + ".tbl";
}