Java String Capitalize capitalize(String s)

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

Description

capitalize

License

LGPL

Declaration

public static String capitalize(String s) 

Method Source Code

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

public class Main {
    public static String capitalize(String s) {
        String[] split = s.split("_");
        String result = "";

        for (int i = 0; i < split.length; i++) {
            if (i != 0) {
                result += " " + split[i].substring(0, 1).toUpperCase() + split[i].substring(1);
            } else {
                result += split[i].substring(0, 1).toUpperCase() + split[i].substring(1);
            }/* ww w  .j ava  2 s .  co m*/
        }

        return result;
    }
}

Related

  1. capitalize(String s)
  2. capitalize(String s)
  3. capitalize(String s)
  4. capitalize(String s)
  5. capitalize(String s)
  6. capitalize(String s)
  7. capitalize(String s)
  8. capitalize(String s)
  9. capitalize(String s)