Here you can find the source of underscoreToCamelCase(String wordConstruct)
Parameter | Description |
---|---|
wordConstruct | the word construct to change its split. |
public static String underscoreToCamelCase(String wordConstruct)
//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; } }