Java Utililty Methods String Camel Case Format

List of utility methods to do String Camel Case Format

Description

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

Method

StringtoCamelCase(String original)
Transform a string to the camel case conversion.
StringBuilder sb = new StringBuilder();
String[] parts = original.toLowerCase().split("_");
for (int i = 0; i < parts.length; i++) {
    sb.append(i == 0 ? parts[i] : capitalize(parts[i]));
return sb.toString();
StringtoCamelCase(String originalName)
to Camel Case
String[] words = originalName.split("-+");
StringBuilder nameBuilder = new StringBuilder(originalName.length());
for (String word : words) {
    if (nameBuilder.length() == 0) {
        nameBuilder.append(word);
    } else {
        nameBuilder.append(word.substring(0, 1).toUpperCase());
        nameBuilder.append(word.substring(1));
...
StringtoCamelCase(String origString)
to Camel Case
StringBuffer buffer = new StringBuffer();
buffer.append(Character.toUpperCase(origString.charAt(0)));
buffer.append(origString.substring(1));
return buffer.toString();
StringtoCamelCase(String s)
to Camel Case
String result = "";
String[] args = s.split("\\s+");
for (int i = 0; i < args.length; i++) {
    String arg = args[i];
    if (i > 0) {
        arg = capitalizeFirst(arg);
    result += arg;
...
StringtoCamelCase(String s)
to Camel Case
String[] parts = s.split("_");
if (parts.length > 1) {
    return convertComponentsToCamelCaseName(parts);
} else if (isAllUppercase(s)) {
    s = s.toLowerCase();
return s;
StringtoCamelCase(String s)
For a given string, transform it in such a way that every underscore is removed, and the character following the underscore gets turned into uppercase.
boolean upNext = false;
int size = s.length();
StringBuffer result = new StringBuffer(size);
for (int i = 0; i < size; ++i) {
    char c = s.charAt(i);
    if (c == '_') {
        upNext = true;
    } else {
...
StringtoCamelCase(String s)
To Camel-case
return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
StringtoCamelCase(String s)
Convert a string from "_" delimited to lower camel case
String[] parts = s.split("_");
StringBuilder sb = new StringBuilder();
for (String part : parts) {
    if (sb.length() == 0)
        sb.append(part.toLowerCase());
    else
        sb.append(toProperCase(part));
return sb.toString();
StringtoCamelCase(String s)
Force the first character to be lower case.
String str = s.trim();
StringBuilder buffer = new StringBuilder();
boolean capitalizeNext = true; 
for (int i = 0; i < str.length(); i++) {
    if (!Character.isLetterOrDigit(str.charAt(i))) {
        capitalizeNext = true;
        continue;
    if (capitalizeNext) { 
        buffer.append(Character.toUpperCase(str.charAt(i)));
        capitalizeNext = false;
        continue;
    buffer.append(str.charAt(i));
return buffer.toString();
StringtoCamelCase(String s)
Lower-case the first letter of a string, leaving the rest in it's original case
return s.substring(0, 1).toLowerCase() + s.substring(1);