Java String Upper Case toUpperCaseFirst(String text)

Here you can find the source of toUpperCaseFirst(String text)

Description

Changes the first character of the given text to upper case.

License

Open Source License

Parameter

Parameter Description
text the text which should be capitalized.

Return

the capitalized text.

Declaration

public static String toUpperCaseFirst(String text) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from   w  w  w  .  jav  a 2 s.  c  o  m*/
     * Changes the first character of the given text to upper case.
     * 
     * @param text the text which should be capitalized.
     * @return the capitalized text.
     */
    public static String toUpperCaseFirst(String text) {
        char[] charArray = text.toCharArray();
        charArray[0] = Character.toUpperCase(charArray[0]);
        return String.valueOf(charArray);
    }
}

Related

  1. toUpperCaseAt(String oldString, int index)
  2. toUpperCaseAtFirstChar(String string)
  3. toUpperCaseFirst(String str)
  4. toUpperCaseFirst(String str)
  5. toUpperCaseFirst(String str)
  6. toUpperCaseFirst(String text)
  7. toUpperCaseFirstAll(String text)
  8. toUpperCaseFirstChar(final String str)
  9. toUpperCaseFirstChar(String s)