Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to print a sentence out in a string of camel case java

for (int i = 0; i < text.length(); i++) {
    char currentChar = text.charAt(i);
    if (currentChar == delimiter) {
        shouldConvertNextCharToLower = false;
    } else if (shouldConvertNextCharToLower) {
        builder.append(Character.toLowerCase(currentChar));
    } else {
        builder.append(Character.toUpperCase(currentChar));
        shouldConvertNextCharToLower = true;
    }
}
return builder.toString();
Source by www.baeldung.com #
 
PREVIOUS NEXT
Tagged: #print #sentence #string #camel #case #java
ADD COMMENT
Topic
Name
9+3 =