Here you can find the source of toUnderScoreCase(String s)
public static String toUnderScoreCase(String s)
//package com.java2s; public class Main { public static String toUnderScoreCase(String s) { if (s == null) { return null; }/*from w w w.j av a 2 s . co m*/ return s.replaceAll(String.format("%s|%s|%s", "(?<=[A-Z])(?=[A-Z][a-z])", "(?<=[^A-Z])(?=[A-Z])", "(?<=[A-Za-z])(?=[^A-Za-z])"), "_").toLowerCase(); } }