Java String Underscore to underscoreToCamel(String input, boolean firstLetterUppercase)

Here you can find the source of underscoreToCamel(String input, boolean firstLetterUppercase)

Description

underscore To Camel

License

Apache License

Declaration

private static String underscoreToCamel(String input, boolean firstLetterUppercase) 

Method Source Code

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

public class Main {
    private static String underscoreToCamel(String input, boolean firstLetterUppercase) {
        if (input == null)
            return null;
        StringBuilder builder = new StringBuilder();
        boolean firstFound = false;
        boolean capitalizeNext = firstLetterUppercase;
        for (char c : input.toCharArray()) {
            if (c == '_') {
                if (firstFound) {
                    capitalizeNext = true;
                }/*from   www.j a  va 2  s.  c o m*/
            } else {
                firstFound = true;
                char appendChar = capitalizeNext ? Character.toUpperCase(c) : c;
                builder.append(appendChar);
                capitalizeNext = false;
            }
        }
        return builder.toString();
    }
}

Related

  1. underscore2camel(String underscoreName)
  2. underScore2CamelCase(String strs)
  3. underscoreDashToCamelCase(String s)
  4. underscoresToCamelCaseImpl(String input, boolean capNextLetter)
  5. underscoresToSpaces(String value)
  6. underscoreToCamelCase(String wordConstruct)
  7. underscoreToPascalCase(final String str)
  8. underscoreToSpace(String text)
  9. underscoreToSpace(String value)