Java Utililty Methods String Camel Case To

List of utility methods to do String Camel Case To

Description

The list of methods to do String Camel Case To are organized into topic(s).

Method

StringcamelToComposite(String camel)
camel To Composite
StringBuilder sb = new StringBuilder();
for (int i = 0; i < camel.length(); i++) {
    char ch = camel.charAt(i);
    if (i > 0 && Character.isUpperCase(ch)) {
        sb.append('_');
        sb.append(ch);
    } else {
        sb.append(Character.toUpperCase(ch));
...
StringcamelToFixedString(String str, String fixed)
camel To Fixed String
str = trimToEmpty(str);
if (isEmpty(str)) {
    return str;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.length(); ++i) {
    char c = str.charAt(i);
    if (Character.isUpperCase(c)) {
...
StringcamelToLisp(final String pString)
Converts the input string from camel-style (Java in-fix) naming convention to Lisp-style naming convention (hyphen delimitted, all lower case).
if (pString == null) {
    throw new IllegalArgumentException("string == null");
if (pString.length() == 0) {
    return pString;
StringBuilder buf = null;
int lastPos = 0;
...
StringcamelToLowerSnake(String camel)
Converts camel case string (lower or upper/Pascal) to lower snake case, for example 'helloWorld' or 'HelloWorld' -> 'hello_world' or 'HELLO_WORLD'.
return camelToSnake(camel, false);
StringcamelToPeriod(String value)
camel To Period
return camelToDelimiter(value, "_");
StringcamelToSplitName(String camelName, String split)
camel To Split Name
if (camelName == null || camelName.length() == 0) {
    return camelName;
StringBuilder buf = null;
for (int i = 0; i < camelName.length(); i++) {
    char ch = camelName.charAt(i);
    if (ch >= 'A' && ch <= 'Z') {
        if (buf == null) {
...
StringcamelToSql(String name)
camel To Sql
return name.replaceAll("([A-Z])", "_$1").toLowerCase();
StringcamelToWords(String camel)
camel To Words
StringBuilder sb = new StringBuilder();
for (char c : camel.toCharArray()) {
    if (c >= 'A' && c <= 'Z')
        sb.append(" ").append((char) (c - 'A' + 'a'));
    else
        sb.append(c);
if (sb.charAt(0) == ' ')
...
StringcamelToXmlCase(String s)
 CamelCase -> camel-case camelCASE -> camel-case 
if (s == null) {
    return null;
StringBuilder sb = new StringBuilder();
boolean lastWasLower = false;
for (int i = 0; i < s.length(); i++) {
    char c = s.charAt(i);
    if (Character.isUpperCase(c)) {
...
StringcamelUp(String name)
camel Up
return name.substring(0, 1).toUpperCase().concat(name.substring(1));