Java String Title Case titleCase(String raw)

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

Description

Returns a TitleCase version of the String supplied

License

LGPL

Declaration

public static String titleCase(String raw) 

Method Source Code

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

public class Main {
    /** Returns a TitleCase version of the String supplied */
    public static String titleCase(String raw) {
        String s = raw;/* ww  w .ja va  2s . c o m*/
        if (s != null) {
            if (s.length() > 1) {
                s = s.substring(0, 1).toUpperCase() + s.substring(1);
            } else if (s.length() == 1) {
                s = s.toUpperCase();
            }
        }

        return s;
    }
}

Related

  1. titleCase(final String s)
  2. titleCase(final String text)
  3. titleCase(String in)
  4. titleCase(String input)
  5. titleCase(String name)
  6. titleCase(String realName)
  7. titleCase(String s)
  8. titleCase(String str)
  9. titlecase(String str)