Java String Upper Case toUpperCase(String s)

Here you can find the source of toUpperCase(String s)

Description

Locale-independent variant of String#toUpperCase() .

License

Open Source License

Declaration

public static String toUpperCase(String s) 

Method Source Code

//package com.java2s;
//it under the terms of the GNU Affero General Public License as published by

public class Main {
    /**/*from  w  w  w  .ja v a2s  .co m*/
     * Locale-independent variant of {@link String#toUpperCase()}.
     * This method works on {@code char} level and hence uses a locale-independent
     * character mapping as defined by the Unicode standard.
     */
    public static String toUpperCase(String s) {
        StringBuilder sb = new StringBuilder(s);
        for (int i = 0, len = sb.length(); i < len; i++) {
            char ch = sb.charAt(i);
            char ch2 = Character.toUpperCase(ch);
            if (ch != ch2)
                sb.setCharAt(i, ch2);
        }
        return sb.toString();
    }
}

Related

  1. toUpperCase(String input)
  2. toUpperCase(String pString)
  3. toUpperCase(String s)
  4. toUpperCase(String s)
  5. toUpperCase(String s)
  6. toUpperCase(String s)
  7. toUpperCase(String s)
  8. toUpperCase(String s)
  9. toUpperCase(String s, int start, int end)