Java String Capitalize Word capitalizeWord(String word)

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

Description

Convert the initial of given string word to upper case.

License

Apache License

Parameter

Parameter Description
word the string to be transfered

Return

if given string is a valid string , then return string with upper case initial character.

Declaration

public static String capitalizeWord(String word) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*from  w w  w  .j  a v a2  s .  co m*/
     * Convert the initial of given string <code>word</code> to upper case.
     * @param word  the string to be transfered
     * @return if given string is a valid string , then return string with
     * upper case initial character.
     */
    public static String capitalizeWord(String word) {
        String result = null;

        if ((word != null) && (word.trim().length() > 0)) {
            result = word.substring(0, 1).toUpperCase() + word.substring(1);
        } else {
            result = word;
        }

        return result;
    }
}

Related

  1. capitalizeOneWord(String inputWord)
  2. capitalizeSingle(String word)
  3. capitalizeWord(String s)
  4. capitalizeWord(String s)
  5. capitalizeWord(String str)
  6. capitalizeWord(String word)
  7. capitalizeWord(String word)
  8. capitalizeWords(final String text)
  9. capitalizeWords(String data)