Example usage for java.lang Character toLowerCase

List of usage examples for java.lang Character toLowerCase

Introduction

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

Prototype

public static int toLowerCase(int codePoint) 

Source Link

Document

Converts the character (Unicode code point) argument to lowercase using case mapping information from the UnicodeData file.

Usage

From source file:Main.java

public static String unCapitalize(String str) {
    return Character.toLowerCase(str.charAt(0)) + str.substring(1);
}

From source file:Main.java

public static String getFirstLowerCase(String word) {
    return Character.toLowerCase(word.charAt(0)) + word.substring(1);
}

From source file:Main.java

private static String toIdName(String fieldName) {
    String idName = String.valueOf(Character.toLowerCase(fieldName.charAt(1)));

    for (int i = 2, length = fieldName.length(); i < length; ++i) {
        char c = fieldName.charAt(i);
        if (Character.isUpperCase(c)) {
            idName = idName + ID_SEPARATOR + Character.toLowerCase(c);
        } else {//from  w  w w . j a  va  2  s .  c om
            idName += c;
        }
    }

    return idName;
}

From source file:Main.java

public static String cutPreAndLowerFirst(String str, int preLength) {
    if (str == null) {
        return null;
    }/* ww  w. j  a  va  2s .  c o  m*/
    if (str.length() > preLength) {
        char first = Character.toLowerCase(str.charAt(preLength));
        if (str.length() > preLength + 1) {
            return first + str.substring(preLength + 1);
        }
        return String.valueOf(first);
    }
    return null;
}

From source file:Main.java

public static char toLowerCase(char a) {
    if (a < 'A' || a >= 'a' && a <= 'z') {
        return a;
    }/*w w  w .  j a va2  s.c om*/

    if (a <= 'Z') {
        return (char) (a + ('a' - 'A'));
    }

    return Character.toLowerCase(a);
}

From source file:Main.java

static String toDbColumName(String name) {
    StringBuilder sb = new StringBuilder();
    for (int i = 0, size = name.length(); i < size; i++) {
        char c = name.charAt(i);
        if (c >= 'A' && c <= 'Z') {
            sb.append("_" + Character.toLowerCase(c));
        } else {/*from   w w w .jav a 2 s .  c o  m*/
            sb.append(c);
        }
    }
    return sb.toString();
}

From source file:Main.java

public static String convertMaskedPhone(String phone) {
    StringBuilder phoneNumber = new StringBuilder(phone);
    for (int i = 0; i < phoneNumber.length(); i++) {
        switch (Character.toLowerCase(phoneNumber.charAt(i))) {
        case 'a':
        case 'b':
        case 'c':
            phoneNumber.setCharAt(i, '2');
            break;
        case 'd':
        case 'e':
        case 'f':
            phoneNumber.setCharAt(i, '3');
            break;
        case 'g':
        case 'h':
        case 'i':
            phoneNumber.setCharAt(i, '4');
            break;
        case 'j':
        case 'k':
        case 'l':
            phoneNumber.setCharAt(i, '5');
            break;
        case 'm':
        case 'n':
        case 'o':
            phoneNumber.setCharAt(i, '6');
            break;
        case 'p':
        case 'q':
        case 'r':
        case 's':
            phoneNumber.setCharAt(i, '7');
            break;
        case 't':
        case 'u':
        case 'v':
            phoneNumber.setCharAt(i, '8');
            break;
        case 'w':
        case 'x':
        case 'y':
        case 'z':
            phoneNumber.setCharAt(i, '9');
            break;
        case '+':
            phoneNumber.setCharAt(i, '0');
            break;
        }//from  w w w. j a  v a2 s.c  om
    }
    return phoneNumber.toString();
}

From source file:Main.java

public static CharSequence toLowerCase(CharSequence character) {
    if (character == null || character.equals("")) {
        return character;
    }//from w  ww .  jav a  2s  .c o  m
    StringBuffer buffer = new StringBuffer();
    for (int i = 0; i < character.length(); i++) {
        buffer.append(Character.toLowerCase(character.charAt(i)));
    }
    return buffer.toString();
}

From source file:Main.java

/**
 * Get a parameter name from a method name.
 *
 * @param methodName the method name/*from  w  w w  .ja v a  2 s  .c  o m*/
 * @return the parameter name
 */
public static String parameterName(final String methodName) {
    StringBuilder buf = new StringBuilder(methodName.substring(3));
    buf.setCharAt(0, Character.toLowerCase(methodName.charAt(3)));
    return buf.toString();
}

From source file:Main.java

public static String normalize(String s) {
    if (noString(s))
        return null;
    StringBuilder b = new StringBuilder();
    boolean isWhitespace = false;
    for (int i = 0; i < s.length(); i++) {
        char c = s.charAt(i);
        if (!Character.isWhitespace(c)) {
            b.append(Character.toLowerCase(c));
            isWhitespace = false;//ww w .j  a  v  a2s.c  om
        } else if (!isWhitespace) {
            b.append(' ');
            isWhitespace = true;
        }
    }
    return b.toString().trim();
}