Here you can find the source of underscoreToPascalCase(final String str)
public static String underscoreToPascalCase(final String str)
//package com.java2s; public class Main { public static String underscoreToPascalCase(final String str) { return underscoreTo(str, true); }/*from w w w . j a va 2 s. c o m*/ private static String underscoreTo(final String str, final boolean pascal) { final StringBuilder sb = new StringBuilder(); boolean underscore = false; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == '_') { underscore = true; } else { if (underscore || (i == 0 && pascal)) { sb.append(Character.toUpperCase(c)); } else { sb.append(c); } underscore = false; } } return sb.toString(); } }