Java String Capitalize Full capitalizeFully(String text)

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

Description

capitalize Fully

License

Open Source License

Declaration

static public String capitalizeFully(String text) 

Method Source Code

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

public class Main {
    static public String capitalizeFully(String text) {

        String[] split = text.split(" ");
        for (int i = 0; i < split.length; ++i) {
            char[] chars = split[i].toCharArray();
            chars[0] = Character.toUpperCase(chars[0]);
            split[i] = new String(chars);
        }/*from  ww  w .  j  ava2 s . c  om*/
        return implode(split, " ");

    }

    public static String implode(String[] strings) {
        return implode(strings, "");
    }

    public static String implode(String[] strings, String glue) {

        String output = "";

        if (strings.length > 0) {
            StringBuilder sb = new StringBuilder();
            sb.append(strings[0]);
            for (int i = 1; i < strings.length; i++) {
                sb.append(glue);
                sb.append(strings);
            }
            output = sb.toString();
        }

        return output;

    }
}

Related

  1. capitalizeFully(String str)
  2. capitalizeFully(String str)
  3. capitalizeFully(String str, final char... delimiters)
  4. capitalizeFully(String str, final char... delimiters)
  5. capitalizeFully(String string)
  6. capitalizeFully(String to_capitalize)