public static String camelCaseToUnderscore ( final String camelCaseString ) { final StringBuilder sb = new StringBuilder ( ) ; for ( final String camelPart : camelCaseString . split ( "(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])" ) ) { if ( sb . length ( ) > 0 ) { sb . append ( CASE_SEPARATOR ) ; } sb . append ( camelPart . toUpperCase ( Locale . getDefault ( ) ) ) ; } return sb . toString ( ) ; }
Convert aStringUnderscored into A_STRING_UNDESCORED .