Java String Underscore to underscoreToCamelCase(String wordConstruct)

Here you can find the source of underscoreToCamelCase(String wordConstruct)

Description

Receives a word construct split in underscores and converts it to camelCase.

License

Apache License

Parameter

Parameter Description
wordConstruct the word construct to change its split.

Return

the camelCased word construct

Declaration

public static String underscoreToCamelCase(String wordConstruct) 

Method Source Code

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

public class Main {
    /**/*from w w w .  ja v a2  s.c  o m*/
     * Receives a word construct split in underscores and converts it to camelCase.
     * Example: virtual_machine --> virtualMachine
     * 
     * @param wordConstruct the word construct to change its split.
     * @return the camelCased word construct
     */
    public static String underscoreToCamelCase(String wordConstruct) {
        String[] words = wordConstruct.split("_");
        String camelCaseWordConstruct = "";
        for (String word : words) {
            if (!camelCaseWordConstruct.equals("")) {
                if (!word.equals(""))
                    camelCaseWordConstruct += word.substring(0, 1).toUpperCase() + word.substring(1);
            } else
                camelCaseWordConstruct += word;
        }
        return camelCaseWordConstruct;
    }
}

Related

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