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

StringcamelCaseToSeparatorCase(String s, String separator)
camel Case To Separator Case
char[] input = s.toCharArray();
StringBuilder output = new StringBuilder();
for (int i = 0; i < input.length; i++) {
    char c = input[i];
    if (Character.isLowerCase(c) || isSpecialCharacter(c)) {
        output.append(c);
    } else {
        if (i > 0) {
...
StringcamelCaseToSpacedString(String camel)
camel Case To Spaced String
StringBuilder result = new StringBuilder();
int i = 0;
while (i < camel.length()) {
    char c = camel.charAt(i);
    if (Character.isUpperCase(c) && i != 0) {
        result.append(' ');
        int initialUpperCaseLetterIndex = i;
        while (i < camel.length() && Character.isUpperCase(camel.charAt(i))) {
...
StringcamelcaseToUppercase(String camelCase)
Converts a name that's given in camel-case into upper-case, inserting underscores before upper-case letters.
int n = camelCase.length();
StringBuilder upperCase = new StringBuilder(n * 4 / 3);
for (int i = 0; i < n; ++i) {
    char ch = camelCase.charAt(i);
    if (Character.isUpperCase(ch)) {
        upperCase.append('_');
        upperCase.append(ch);
    } else {
...
StringcamelCaseToWords(String data)
camel Case To Words
final StringBuilder stringBuilder = new StringBuilder();
for (String w : data.split("(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])")) {
    stringBuilder.append(w).append(' ');
return stringBuilder.toString().trim();
StringcamelCaseUnderscores(String str)
camel Case Underscores
StringBuffer buff = new StringBuffer();
boolean capitalize = false;
boolean doAppend = false;
for (int i = 0; i < str.length(); i++) {
    char ch = str.charAt(i);
    if (capitalize) {
        ch = Character.toUpperCase(ch);
        doAppend = true;
...
StringcamelHump(String str)
camel Hump
if (str != null && (str = str.trim()).length() > 0) {
    str = str.substring(0, 1).toUpperCase() + str.substring(1);
return str;
String[]camelHumpsToWords(String camelHumps)
camel Humps To Words
return camelHumpsToWords0(camelHumps, 0, 0);
StringcamelhumpToUnderline(String str)
camelhump To Underline
final int size;
final char[] chars;
final StringBuilder sb = new StringBuilder((size = (chars = str.toCharArray()).length) * 3 / 2 + 1);
char c;
for (int i = 0; i < size; i++) {
    c = chars[i];
    if (isLowercaseAlpha(c)) {
        sb.append(toUpperAscii(c));
...
StringcamelizeOneWord(String word, boolean firstLetterInLowerCase)
camelize One Word
if (word == null || "".equals(word))
    return word;
String firstChar = word.substring(0, 1);
String result = (firstLetterInLowerCase) ? firstChar.toLowerCase() : firstChar.toUpperCase();
if (word.length() > 1) {
    result += word.substring(1);
return result;
...
StringcamelPrefix(String str, int prefixSize)
camel Prefix
return prefixSize + 1 >= str.length() ? str
        : Character.isUpperCase(str.charAt(prefixSize)) ? str.substring(0, prefixSize + 2) + "\u2026"
                : str.substring(0, prefixSize + 1) + "\u2026";