Here you can find the source of camelCase(String str)
public static String camelCase(String str)
//package com.java2s; //License from project: Apache License public class Main { public static String camelCase(String str) { StringBuilder sb = new StringBuilder(); char[] chs = str.toCharArray(); boolean isUnderLine = false; for (int i = 0; i < chs.length; i++) { char ch = chs[i]; if (ch == '_') { isUnderLine = true;/* www .j ava 2s.co m*/ } else { if (isUnderLine) { sb.append(String.valueOf(ch).toUpperCase()); } else { sb.append(String.valueOf(ch).toLowerCase()); } isUnderLine = false; } } return sb.toString(); } }