Java String Camel Case Format toCamelCase(String str)

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

Description

to Camel Case

License

Open Source License

Declaration

public static String toCamelCase(String str) 

Method Source Code

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

public class Main {
    public static String toCamelCase(String str) {
        if (str == null || str.length() == 0)
            return "";

        String[] parts = str.split("_");
        String ret = new String();

        for (int i = 0; i < parts.length; i++) {
            String part = parts[i];

            if (i == 0)
                ret += part.substring(0, 1).toLowerCase();
            else/* w ww.j  a va  2 s. c om*/
                ret += part.substring(0, 1).toUpperCase();

            ret += part.substring(1).toLowerCase();
        }

        return ret;
    }
}

Related

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