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 string)
Converts a string to camel case, separated by spaces
String result = "";
if (string.length() == 0) {
    return "";
} else {
    for (String part : string.split(" ")) {
        result += Character.toUpperCase(part.charAt(0));
        if (string.length() > 1) {
            result += part.substring(1, part.length()).toLowerCase();
...
StringtoCamelCase(String string)
to Camel Case
char begin = Character.toLowerCase(string.charAt(0));
if (string.length() == 1) {
    return Character.toString(begin);
} else {
    return begin + string.substring(1);
StringtoCamelCase(String string)
Get a camel case version of a string
return string.substring(0, 1).toUpperCase() + string.substring(1).toLowerCase();
StringtoCamelCase(String string)
Simple wrapper to toCamelCase which sets lowerCase to false.
return toCamelCase(string, false);
StringtoCamelCase(String stringValue, String delimiter)
to Camel Case
StringBuffer result = new StringBuffer(stringValue.length());
String[] strings = parseString(stringValue.toLowerCase(), delimiter);
for (int i = 0; i < strings.length; ++i) {
    char[] characters = strings[i].toCharArray();
    if (characters.length > 0) {
        characters[0] = Character.toUpperCase(characters[0]);
        result.append(characters);
return result.toString();
StringtoCamelCase(String text)
Converts the string to camel case.
int count = 0;
final StringBuilder sb = new StringBuilder();
final String[] words = text.replace('_', ' ').split(" "); 
for (String word : words) {
    count++;
    if (word.length() == 1) {
        sb.append(word.toUpperCase());
    } else if (word.length() > 1) {
...
StringtoCamelCase(String text)
Create a camel case string (eg.
if (text.indexOf('_') >= 0) {
    StringBuffer buff = new StringBuffer(text.length());
    boolean afterHyphen = false;
    for (int n = 0; n < text.length(); n++) {
        char c = text.charAt(n);
        if (c == '_') {
            afterHyphen = true;
        } else {
...
StringtoCamelCase(String text)
Takes a string, removes all characters that are not letters or digits and capitalizes the next letter following a series of characters that are not letters or digits.
int length = text.length();
StringBuilder builder = new StringBuilder(length);
boolean capitalizeNextChar = false;
for (int i = 0; i < length; i++) {
    char theChar = text.charAt(i);
    if (Character.isLetterOrDigit(theChar) || theChar == '.') {
        if (capitalizeNextChar) {
            builder.append(Character.toUpperCase(theChar));
...
StringtoCamelCase(String text, boolean capFirstLetter)
to Camel Case
String[] parts = text.split("[_]");
StringBuilder buf = new StringBuilder();
for (int i = 0; i < parts.length; i++) {
    String lc = parts[i].toLowerCase();
    if (i > 0 || capFirstLetter) {
        buf.append(Character.toUpperCase(lc.charAt(0)));
        buf.append(lc.substring(1));
    } else {
...
StringtoCamelCase(String value)
to Camel Case
StringBuilder camelCase = new StringBuilder();
char[] characters = value.toCharArray();
for (int i = 0; i < characters.length; i++) {
    i = ignoreWhitespace(characters, i);
    if (i == -1)
        break;
    if (camelCase.length() == 0)
        camelCase.append(Character.toLowerCase(characters[i]));
...