Java String Camel Case Format toCamelCase(String input)

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

Description

to Camel Case

License

Open Source License

Declaration

public static String toCamelCase(String input) 

Method Source Code

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

public class Main {
    public static String toCamelCase(String input) {
        String inputLowerCase = input.toLowerCase();
        StringBuilder sb = new StringBuilder();
        final char delim = '_';
        char value;
        boolean capitalize = false;
        for (int i = 0; i < inputLowerCase.length(); ++i) {
            value = inputLowerCase.charAt(i);
            if (value == delim) {
                capitalize = true;/*  ww  w.java 2  s .com*/
            } else if (capitalize) {
                sb.append(Character.toUpperCase(value));
                capitalize = false;
            } else {
                sb.append(value);
            }
        }

        return sb.toString();
    }
}

Related

  1. toCamelCase(String begin, String... parts)
  2. toCamelCase(String columnName)
  3. toCamelCase(String dashCase)
  4. toCamelCase(String id)
  5. toCamelCase(String in, boolean startWithUpper)
  6. toCamelCase(String input)
  7. toCamelCase(String input)
  8. toCamelCase(String input, boolean capitalizeFirsLetter)
  9. toCamelCase(String input, boolean firstCharUppercase, char separator)