Java String Capitalize capitalize(String word)

Here you can find the source of capitalize(String word)

Description

capitalize

License

Open Source License

Parameter

Parameter Description
word a parameter

Return

the word with the first character capitalized, if applicable

Declaration

public static String capitalize(String word) 

Method Source Code

//package com.java2s;

public class Main {
    /**//w  ww.j  a va2 s.c  o  m
     * @param word
     * @return the word with the first character capitalized, if applicable
     */
    public static String capitalize(String word) {
        String capitalizedWord = word;
        if (Character.isLowerCase(word.charAt(0))) {
            capitalizedWord = "" + Character.toUpperCase(word.charAt(0)) + word.substring(1);
        }
        return capitalizedWord;
    }
}

Related

  1. capitalize(String value)
  2. capitalize(String value)
  3. capitalize(String value)
  4. capitalize(String value)
  5. capitalize(String var)
  6. capitalize(String word)
  7. capitalize(String word)
  8. capitalize(String word)
  9. capitalize(String word)