Java String Camel Case Format toCamelCase(String str)

Here you can find the source of toCamelCase(String str)

Description

Converts the supplied string to CamelCase by converting the first character to upper case and the rest of the string to lower case.

License

Open Source License

Parameter

Parameter Description
str the input string

Return

a string

Declaration

public static String toCamelCase(String str) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from  www. j av a  2 s .c  o m*/
     * Converts the supplied string to CamelCase by converting the first character to upper case and the rest of the
     * string to lower case.
     *
     * @param str the input string
     * @return a string
     */
    public static String toCamelCase(String str) {
        String firstLetter = str.substring(0, 1);
        String rest = str.substring(1);
        return firstLetter.toUpperCase() + rest.toLowerCase();
    }
}

Related

  1. toCamelCase(String s, boolean firstCharUppercase)
  2. toCamelCase(String s, Boolean firstUpper)
  3. toCamelCase(String s, String separator, boolean capitalizeFirstPart)
  4. toCamelCase(String start)
  5. toCamelCase(String str)
  6. toCamelCase(String str)
  7. toCamelCase(String str)
  8. toCamelCase(String str)
  9. toCamelCase(String str)