Java String Capitalize capitalize(String word)

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

Description

capitalize

License

Open Source License

Declaration

public static String capitalize(String word) 

Method Source Code

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

public class Main {
    public static String capitalize(String word) {
        if (word.length() == 0)
            return word;
        switch (word) {
        case "of":
        case "the":
        case "in":
        case "with":
        case "and":
        case "for":
        case "by":
            return word;
        default:/*from w  w w .ja  v a 2 s .c o m*/
            return word.substring(0, 1).toUpperCase() + word.substring(1);
        }
    }
}

Related

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