Java String Capitalize Word capitalizeOneWord(String inputWord)

Here you can find the source of capitalizeOneWord(String inputWord)

Description

Capitalize one word.

License

Open Source License

Parameter

Parameter Description
inputWord The input, e.g. "aBa"

Return

The outpu, e.g "Aba"

Declaration

public static String capitalizeOneWord(String inputWord) 

Method Source Code

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

public class Main {
    /**// ww  w. j a va  2s .  c o m
     * Capitalize one word.
     * 
     * @param inputWord
     *            The input, e.g. "aBa"
     * @return The outpu, e.g "Aba"
     */
    public static String capitalizeOneWord(String inputWord) {
        String firstLetter = inputWord.substring(0, 1); // Get first letter
        String remainder = inputWord.substring(1); // Get remainder of word.
        return firstLetter.toUpperCase() + remainder.toLowerCase();
    }
}

Related

  1. capitalizeFirstLetter(String word)
  2. capitalizeFirstLetterEachWord(String sentence)
  3. capitalizeFirstLetterWord(String word)
  4. capitalizeFirsts(String word)
  5. capitalizeInitials(String words)
  6. capitalizeSingle(String word)
  7. capitalizeWord(String s)
  8. capitalizeWord(String s)
  9. capitalizeWord(String str)