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 void main(String[] argv) {
    System.out.println(Character.toUpperCase('t'));

}

From source file:Main.java

public static void main(String[] args) {
    int cp1 = 0x0071;
    int cp2 = 0x0570;

    int cp3 = Character.toUpperCase(cp1);
    int cp4 = Character.toUpperCase(cp2);

    String str1 = "Uppercase equivalent of " + cp1 + " is " + cp3;
    String str2 = "Uppercase equivalent of " + cp2 + " is " + cp4;

    System.out.println(str1);//  ww w.j  ava  2s  .c om
    System.out.println(str2);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    BufferedReader br = new BufferedReader(new FileReader("in.txt"));
    BufferedWriter bw = new BufferedWriter(new FileWriter("out.txt"));
    int i;/*from ww w  .  jav  a2  s.  c  o  m*/
    do {
        i = br.read();
        if (i != -1) {
            if (Character.isLowerCase((char) i))
                bw.write(Character.toUpperCase((char) i));
            else if (Character.isUpperCase((char) i))
                bw.write(Character.toLowerCase((char) i));
            else
                bw.write((char) i);
        }
    } while (i != -1);
    br.close();
    bw.close();
}

From source file:MainClass.java

public static void main(String args[]) throws IOException {
    String tmp = "abc";
    byte b[] = tmp.getBytes();
    ByteArrayInputStream in = new ByteArrayInputStream(b);

    for (int i = 0; i < 2; i++) {
        int c;//from   w w  w  .j ava2  s.c  o m
        while ((c = in.read()) != -1) {
            if (i == 0) {
                System.out.print((char) c);
            } else {
                System.out.print(Character.toUpperCase((char) c));
            }
        }
        System.out.println();
        in.reset();
    }
}

From source file:AllCapsDemo.java

License:asdf

public static void main(String[] arguments) {
    String sourceName = "asdf";
    try {//from  w  ww.  java2s .  c om
        File source = new File(sourceName);
        File temp = new File("cap" + sourceName + ".tmp");

        FileReader fr = new FileReader(source);
        BufferedReader in = new BufferedReader(fr);

        FileWriter fw = new FileWriter(temp);
        BufferedWriter out = new BufferedWriter(fw);

        boolean eof = false;
        int inChar = 0;
        do {
            inChar = in.read();
            if (inChar != -1) {
                char outChar = Character.toUpperCase((char) inChar);
                out.write(outChar);
            } else
                eof = true;
        } while (!eof);
        in.close();
        out.close();

        boolean deleted = source.delete();
        if (deleted)
            temp.renameTo(source);
    } catch (Exception se) {
        System.out.println("Error - " + se.toString());
    }
}

From source file:Main.java

public static void main(String[] args) {
    // Using the constructor
    Character c1 = new Character('A');

    // Using the factory method - preferred
    Character c2 = Character.valueOf('2');
    Character c3 = Character.valueOf('-');

    // Getting the wrapped char values
    char cc1 = c1.charValue();
    char cc2 = c2.charValue();
    char cc3 = c3.charValue();

    System.out.println("c1 = " + c1);
    System.out.println("c2 = " + c2);
    System.out.println("c3 = " + c3);

    // Using some Character class methods on c1
    System.out.println("isLowerCase c1    = " + Character.isLowerCase(cc1));
    System.out.println("isDigit c1    = " + Character.isDigit(cc1));
    System.out.println("isLetter c1    = " + Character.isLetter(cc1));
    System.out.println("Lowercase of  c1    = " + Character.toLowerCase(cc1));

    // Using some Character class methods on c2
    System.out.println("isLowerCase c2    = " + Character.isLowerCase(cc2));
    System.out.println("isDigit c2    = " + Character.isDigit(cc2));
    System.out.println("isLetter c2    = " + Character.isLetter(cc2));
    System.out.println("Lowercase of  c2    = " + Character.toLowerCase(cc2));

    System.out.println("Uppercase of  c3    = " + Character.toUpperCase(cc3));

}

From source file:Main.java

private static char ToBig(String name) {
    char ch = name.charAt(0);
    ch = Character.toUpperCase(ch);
    return ch;
}

From source file:Main.java

private static byte charToByte(char ch) {
    return ((ch >= '0') && (ch <= '9')) ? (byte) (ch - '0') : (byte) (Character.toUpperCase(ch) - 'A' + 10);
}

From source file:Main.java

public static String getMethodName(String name) {
    char[] ch = name.toCharArray();
    ch[0] = Character.toUpperCase(ch[0]);

    return "get" + String.valueOf(ch);
}

From source file:Main.java

public static String setMethodName(String name) {
    char[] ch = name.toCharArray();
    ch[0] = Character.toUpperCase(ch[0]);

    return "set" + String.valueOf(ch);
}