Java String Camel Case Format toCamelCase(String input)

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

Description

Transform a dashed input into camelcased

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 {
    /**/* w  ww . j a v a2s. c  o  m*/
     * Transform a dashed input into camelcased
     */
    public static String toCamelCase(String input) {
        String newinput = "";

        for (int i = 0; i < input.length(); i++) {
            char theChar = input.charAt(i);
            if (theChar == '-') {
                newinput += input.substring(i + 1, i + 2).toUpperCase();
                i += 1;
            } else {
                newinput += theChar;
            }
        }

        return newinput;
    }
}

Related

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