Java String Title Case titleCase(String s)

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

Description

Returns a title case version of the String.

License

LGPL

Parameter

Parameter Description
s a parameter

Declaration

private static String titleCase(String s) 

Method Source Code

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

public class Main {
    /**//from  w  ww. j a v  a  2  s . co  m
     * Returns a title case version of the String.
     * 
     * @param s
     * @return
     */
    private static String titleCase(String s) {
        if (s.length() > 1) {
            return s.substring(0, 1).toUpperCase() + s.substring(1);
        }
        return s.toUpperCase();
    }
}

Related

  1. titleCase(String in)
  2. titleCase(String input)
  3. titleCase(String name)
  4. titleCase(String raw)
  5. titleCase(String realName)
  6. titleCase(String str)
  7. titlecase(String str)
  8. titleCase(String txt)
  9. titleCasedName(T instance)