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:Main.java

private static String readEncoding(String contentEncoding, String contentType, String fallback) {
    String encoding = fallback;/*from   w  w  w  . j a v a2s . c  o  m*/
    String[] values = contentType.split(";");
    if (contentEncoding != null) {
        encoding = contentEncoding;
    } else {
        for (String value : values) {
            value = value.trim();
            if (value.toLowerCase().startsWith("charset=")) {
                encoding = value.substring("charset=".length());
            }
        }
    }
    return encoding;
}

From source file:Main.java

/**
 * Check if file is an image based on it's extension.
 *
 * @see <a href="http://developer.android.com/guide/appendix/media-formats.html">Supported Media Formats</a>
 *///w ww .  j  av a  2s  .  c  o  m
public static boolean isImage(String filename) {
    if (filename == null)
        return false;

    if (filename.toLowerCase().endsWith(".png") || filename.toLowerCase().endsWith(".jpg")
            || filename.toLowerCase().endsWith(".bmp") || filename.toLowerCase().endsWith(".gif")) {
        return true;
    }
    return false;
}

From source file:Main.java

private static String getFirstLowerVariables(String variables) {
    String firstLetter = variables.substring(0, 1);
    variables = variables.replaceFirst(firstLetter, firstLetter.toLowerCase());
    return variables;
}

From source file:com.alifi.jgenerator.utils.StringFormatUtils.java

/**
 *  ?//from w w  w . j  a v a  2  s . co m
 * 
 * @param str
 * @return
 */
public static String humpCPix(String pix, String str) {
    if (StringUtils.isNotEmpty(str)) {
        String strs = str.toLowerCase();
        String pixx = pix.toLowerCase();
        return hump(strs.replaceFirst(pixx, "").replaceAll("_", " "));
    }
    return null;
}

From source file:Main.java

public static byte[] UdpHexDecode(String s) {
    byte abyte0[] = new byte[s.length() / 2];
    String s1 = s.toLowerCase();
    for (int i = 0; i < s1.length(); i += 2) {
        char c = s1.charAt(i);
        char c1 = s1.charAt(i + 1);
        int j = i / 2;
        if (c < 'a')
            abyte0[j] = (byte) (c - 48 << 4);
        else//from   ww w .jav  a  2 s  . c om
            abyte0[j] = (byte) ((c - 97) + 10 << 4);
        if (c1 < 'a')
            abyte0[j] += (byte) (c1 - 48);
        else
            abyte0[j] += (byte) ((c1 - 97) + 10);
    }
    return abyte0;
}

From source file:Main.java

public static String getCpuInfo() {
    String str1 = "/proc/cpuinfo";
    String str2 = "";
    String[] cpuInfo = { "", "" };
    String[] arrayOfString;/* w ww  .j  a v a 2  s .  c  om*/
    try {
        FileReader fr = new FileReader(str1);
        BufferedReader localBufferedReader = new BufferedReader(fr, 8192);
        str2 = localBufferedReader.readLine();
        arrayOfString = str2.split("\\s+");
        for (int i = 2; i < arrayOfString.length; i++) {
            cpuInfo[0] = cpuInfo[0] + arrayOfString[i] + " ";
        }
        str2 = localBufferedReader.readLine();
        arrayOfString = str2.split("\\s+");
        cpuInfo[1] += arrayOfString[2];
        localBufferedReader.close();
    } catch (IOException e) {
    }

    StringBuilder builder = new StringBuilder();
    for (String s : cpuInfo) {
        builder.append(s.toLowerCase() + ",");
    }
    return builder.toString();
}

From source file:org.hawkular.metrics.core.api.AvailabilityType.java

public static AvailabilityType fromString(String s) {
    switch (s.toLowerCase()) {
    case "up":
        return UP;
    case "down":
        return DOWN;
    case "unknown":
        return UNKNOWN;
    default:/*from   w  w w  .java 2 s  .c  om*/
        throw new IllegalArgumentException(s + " is not a recognized availability type");
    }
}

From source file:Main.java

public static Object getObject(String type, String value) throws Exception {

    type = type.toLowerCase();
    if ("boolean".equals(type))
        return Boolean.valueOf(value);
    if ("byte".equals(type))
        return Byte.valueOf(value);
    if ("short".equals(type))
        return Short.valueOf(value);
    if ("char".equals(type))
        if (value.length() != 1)
            throw new NumberFormatException("Argument is not a character!");
        else/*from w w  w. j  ava  2 s .  c  o  m*/
            return Character.valueOf(value.toCharArray()[0]);
    if ("int".equals(type))
        return Integer.valueOf(value);
    if ("long".equals(type))
        return Long.valueOf(value);
    if ("float".equals(type))
        return Float.valueOf(value);
    if ("double".equals(type))
        return Double.valueOf(value);
    if ("string".equals(type))
        return value;
    else {
        Object objs[] = new String[] { value };
        return Class.forName(type).getConstructor(new Class[] { java.lang.String.class }).newInstance(objs);
    }
}

From source file:com.twitter.hbc.core.HttpConstants.java

public static boolean isValidHttpScheme(String address) {
    return address.toLowerCase().equalsIgnoreCase(HttpConstants.HTTP_SCHEME)
            || address.toLowerCase().equalsIgnoreCase(HttpConstants.HTTPS_SCHEME);
}

From source file:Main.java

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"));
}