Java String Title Case toTitleCase(String s)

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

Description

to Title Case

License

LGPL

Declaration

public static String toTitleCase(String s) 

Method Source Code

//package com.java2s;
/**// ww  w  . j  a v  a2 s  . co m
* Converts a line of text into an array of lower case words using a
* BreakIterator.wordInstance().
* <p>
* 
* This method is under the Jive Open Source Software License and was written
* by Mark Imbriaco.
* 
* @param text
*          a String of text to convert into an array of words
* @return text broken up into an array of words.
*/

public class Main {
    public static String toTitleCase(String s) {
        StringBuffer stringbuffer = new StringBuffer();
        for (int i = 0; i < s.length(); i++)
            stringbuffer.append(toTitleCase(s.charAt(i)));

        return stringbuffer.toString();
    }

    public static char toTitleCase(char c) {
        return Character.toTitleCase(c);
    }

    public static final int length(String baseString) {
        if (baseString == null)
            return 0;
        else
            return baseString.length();
    }
}

Related

  1. toTitleCase(String input, boolean eachWord)
  2. toTitleCase(String inputStr)
  3. toTitleCase(String name)
  4. toTitleCase(String original)
  5. toTitleCase(String original)
  6. toTitleCase(String s)
  7. toTitleCase(String sIn)
  8. toTitleCase(String str)
  9. toTitleCase(String str)