Java String Upper Case toUpperCase(final char c)

Here you can find the source of toUpperCase(final char c)

Description

to Upper Case

License

Open Source License

Declaration

public static char toUpperCase(final char c) 

Method Source Code

//package com.java2s;
/*/*from w  w  w . j av  a  2  s. c  o  m*/
 * Copyright (c) 2015 Gargoyle Software Inc.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (http://www.gnu.org/licenses/).
 */

public class Main {
    public static char toUpperCase(final char c) {
        return (char) toUpperCase((int) c);
    }

    public static int toUpperCase(final int c) {
        if (c < 128) {
            return ('a' <= c && c <= 'z') ? c + ('A' - 'a') : c;
        }
        // Do not convert non-ASCII lower case character to ASCII upper case.
        final int upper = Character.toUpperCase(c);
        return (upper < 128) ? c : upper;
    }
}

Related

  1. toUpperCase(CharSequence string)
  2. toUpperCase(final String s)
  3. toUpperCase(final String s)
  4. toUpperCase(final String s)
  5. toUpperCase(final StringBuilder src)