Java String Capitalize capitalize(String text)

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

Description

capitalize

License

Open Source License

Declaration

public static String capitalize(String text) 

Method Source Code

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

public class Main {
    public static String capitalize(String text) {
        StringBuilder cap = new StringBuilder();
        text = text.replace("_", " ");
        for (String t : text.split(" ")) {
            if (t.length() > 2) {
                cap.append(t.substring(0, 1).toUpperCase()).append(t.substring(1).toLowerCase()).append(" ");
            } else {
                cap.append(t).append(" ");
            }//from  w ww .  j a v a 2s .  com
        }
        return cap.substring(0, cap.length() - 1);
    }
}

Related

  1. capitalize(String string0)
  2. capitalize(String text)
  3. capitalize(String text)
  4. capitalize(String text)
  5. capitalize(String text)
  6. capitalize(String text)
  7. capitalize(String text)
  8. capitalize(String text)
  9. capitalize(String texte)