Here you can find the source of deCamelCase(final String original)
Parameter | Description |
---|---|
original | the camel cased string |
public static String deCamelCase(final String original)
//package com.java2s; //License from project: BSD License public class Main { /**/*from ww w . j a v a 2 s . co m*/ * Converts a camel cased string into an underscored one, e.g. {@code fooBar} * {@literal ->} {@code foo_bar} * * @param original * the camel cased string * @return de-camel-cased string (or null if original is null) */ public static String deCamelCase(final String original) { if (original == null) return null; if (original.isEmpty()) return original; return original.replaceAll("(.)(\\p{Upper})", "$1_$2").toLowerCase(); } }