Java examples for java.lang:String Case
camel Case To Snake Case with regex
//package com.java2s; import java.util.regex.Pattern; public class Main { private static final Pattern CAMEL_CASE_TO_SNAKE_CASE_PATTERN = Pattern .compile("((?<=[a-z0-9])[A-Z]|(?!^)[A-Z](?=[a-z]))"); public static String camelCaseToSnakeCase(String camelCase) { return CAMEL_CASE_TO_SNAKE_CASE_PATTERN.matcher(camelCase) .replaceAll("_$1").toLowerCase(); }/* ww w .ja v a 2 s .c o m*/ }