Here you can find the source of underScoreCase2CamelCase(String str)
public static final String underScoreCase2CamelCase(String str)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; public class Main { public static final String underScoreCase2CamelCase(String str) { if (!str.contains("_")) return str; StringBuilder sb = new StringBuilder(); char[] chars = str.toCharArray(); boolean hitUnderScore = false; sb.append(chars[0]);/*w w w . j a va 2 s.c o m*/ for (int i = 1; i < chars.length; i++) { char c = chars[i]; if (c == '_') { hitUnderScore = true; } else { if (hitUnderScore) { sb.append(Character.toUpperCase(c)); hitUnderScore = false; } else { sb.append(c); } } } return sb.toString(); } public static boolean contains(Object arr[], Object... obj) { if (arr == null || obj == null || arr.length == 0) return false; return Arrays.asList(arr).containsAll(Arrays.asList(obj)); } public static String toString(Object object) { return toString(object, null); } public static String toString(Object object, String defaultValue) { if (object == null) return defaultValue; return String.valueOf(object); } }