Here you can find the source of camelToSnakeCase(final String camelCase)
public static String camelToSnakeCase(final String camelCase)
//package com.java2s; //License from project: Apache License public class Main { /**/* w ww . j a va 2 s . c om*/ * converts ruby to camel case */ public static String camelToSnakeCase(final String camelCase) { // check for null if (camelCase == null || camelCase.isEmpty()) { return ""; } // simple regex return camelCase.replaceAll("\\B([A-Z])", "_$1").toLowerCase(); } }