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 inputString)
to Camel Case
if (inputString.length() == 0) {
    return inputString;
String[] parts = inputString.split("\\s");
StringBuilder buffer = new StringBuilder();
for (String part : parts) {
    if (parts.length > 0) {
        buffer.append(Character.toUpperCase(part.charAt(0)));
...
StringtoCamelCase(String name)
Converts a string to camel case.
String[] parts = name.split("_");
String result = parts[0];
for (int i = 1; i < parts.length; i++) {
    if (parts[i].length() > 0) {
        result += upperFirstChar(parts[i]);
return result;
...
StringtoCamelCase(String name)
to Camel Case
return toCamelCase(name.split("_"));
StringtoCamelCase(String name)
Returns the input String with a capital first letter, and all the other letters become lower case.
return name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();
StringtoCamelCase(String name)
Converts an underscore-separated name into a camelCase name.
StringBuilder buf = new StringBuilder();
int nextUpper = -1;
for (int i = 0; i < name.length(); i++) {
    char c = name.charAt(i);
    if (c == '_') {
        nextUpper = i + 1;
        continue;
    if (nextUpper == i) {
        c = Character.toUpperCase(c);
    } else {
        c = Character.toLowerCase(c);
    buf.append(c);
return buf.toString();
StringtoCamelCase(String name)
Method to convert case of string into camel case.
name = name.toLowerCase();
String[] parts = name.split(" ");
String camelCaseString = parts[0].substring(0, 1).toLowerCase() + parts[0].substring(1);
for (int i = 1; i < parts.length; i++) {
    camelCaseString = camelCaseString + toProperCase(parts[i]);
return camelCaseString;
StringtoCamelCase(String name)
Creates a capitalized, underscore delimited name from the given camel case name.
StringBuilder buf = new StringBuilder();
if (name.indexOf("_") >= 0) {
    char[] array = name.toLowerCase().toCharArray();
    for (int i = 0; i < array.length; i++) {
        if (i > 0) {
            if (array[i] == '_') {
                int next = i + 1;
                if (next < array.length)
...
StringtoCamelCase(String name)
to Camel Case
String[] words = constantCaseToEnglish(name).split(" ");
StringBuilder s = new StringBuilder();
for (String word : words) {
    s.append(firstToUpper(word));
return s.toString();
StringBuildertoCamelCase(String name)
to Camel Case
StringBuilder buffer = new StringBuilder();
int toUpper = 0;
char c;
for (int i = 0, len = name.length(); i < len;) {
    c = name.charAt(i++);
    if (c == '_') {
        if (i == len)
            break;
...
StringtoCamelCase(String name)
to Camel Case
StringBuilder builder = new StringBuilder(name.length());
for (int i = 0; i < name.length(); ++i) {
    char c = name.charAt(i);
    if (i == 0 && c != '_') {
        builder.append(Character.toUpperCase(c));
    } else if (c == '_' && i < name.length() - 1) {
        ++i;
        builder.append(Character.toUpperCase(name.charAt(i)));
...