Example usage for java.lang Character toUpperCase

List of usage examples for java.lang Character toUpperCase

Introduction

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

Prototype

public static int toUpperCase(int codePoint) 

Source Link

Document

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

Usage

From source file:Main.java

public static String capitalize(String line) {
    if (line.isEmpty()) {
        return "";
    }//  w  w w  . j a va  2s .  co  m

    String retString = Character.toUpperCase(line.charAt(0)) + "";

    if (line.length() > 1) {
        retString = retString + line.substring(1);
    }

    return retString;
}

From source file:Main.java

public static String upper(String txtHeader) {
    if (txtHeader != null) {
        char[] stringArray = txtHeader.toCharArray();
        stringArray[0] = Character.toUpperCase(stringArray[0]);
        txtHeader = new String(stringArray);
        return txtHeader;
    }/*  w w w.j a va2s  .c o  m*/
    return null;

}

From source file:Main.java

public static char toUpperCase(char a) {
    if (a < 'a') {
        return a;
    }//from ww  w .  j av a2 s .  c om
    if (a <= 'z') {
        return (char) (a + ('A' - 'a'));
    }
    return Character.toUpperCase(a);
}

From source file:Main.java

public static String capitalizeFirstChar(String target) {
    StringBuilder capitalized = new StringBuilder(target);
    capitalized.setCharAt(0, Character.toUpperCase(capitalized.charAt(0)));
    return capitalized.toString();
}

From source file:Main.java

public static Method getAppMethod(Class cls, Field field) throws Exception {
    char[] ca = field.getName().toCharArray();
    ca[0] = Character.toUpperCase(ca[0]);
    return cls.getMethod("set" + new String(ca), field.getType());
}

From source file:Main.java

public static boolean charsEqual(@Nullable Character one, @Nullable Character another, boolean ignoreCase) {
    if (ignoreCase) {
        one = one != null ? Character.toUpperCase(one) : null;
        another = another != null ? Character.toUpperCase(another) : null;
    }/*ww  w.ja v  a 2 s  . c o m*/
    return !(one != null ? !one.equals(another) : another != null);
}

From source file:Main.java

public static String getTitleCase(String input) {

    String titleCase = "";
    String[] parts = input.split(" ");

    for (int i = 0; i < parts.length; i++) {
        titleCase += Character.toUpperCase(parts[i].charAt(0)) + parts[i].substring(1).toLowerCase();

        if (i != parts.length - 1) {
            titleCase += " ";
        }//  www  . j  av  a2s .c om
    }

    return titleCase;
}

From source file:Main.java

public static String toInitCap(String param) {

    if (param != null && param.length() > 0) {
        char[] charArray = param.toCharArray(); // convert into char array
        charArray[0] = Character.toUpperCase(charArray[0]); // set capital
        // letter to
        // first//from  w ww .  j ava 2s . c o m
        // postion
        return new String(charArray); // return desired output
    } else {
        return "";
    }
}

From source file:Main.java

private static String camelCase2Upper(String s) {
    String r = "";
    boolean u = false;
    for (int i = 0; i < s.length(); i++) {
        char c = s.charAt(i);
        char C = Character.toUpperCase(c);
        if (Character.isUpperCase(c)) {
            r = r + (u ? ("_" + C) : C);
        } else {/*from   w  w w .  j  ava  2s  .c om*/
            u = true;
            r = r + C;
        }
    }
    return r;
}

From source file:Main.java

/**  name -> Name-> setName */
private static String getMethodName(String propertyName, String prefix) {
    final char[] chars = propertyName.toCharArray();
    chars[0] = Character.toUpperCase(chars[0]);
    return prefix + new String(chars);
}