Here you can find the source of camelCase2UnderScoreCase(String str)
public static final String camelCase2UnderScoreCase(String str)
//package com.java2s; //License from project: Open Source License public class Main { public static final String camelCase2UnderScoreCase(String str) { StringBuilder sb = new StringBuilder(); char[] chars = str.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (Character.isUpperCase(c)) { sb.append("_").append(Character.toLowerCase(c)); } else { sb.append(c);/*from w w w . j a va2 s .com*/ } } return sb.toString(); } 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); } }