Skip to content

Commit

Permalink
Add break statement to toCamelCase (#3871)
Browse files Browse the repository at this point in the history
* Add break statement

* Change charArray conversion to index access

---------

Co-authored-by: 김선우 <[email protected]>
  • Loading branch information
seonWKim and seonWKim authored Dec 31, 2023
1 parent 4b944ba commit b95f117
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,19 @@ private static String lowerUnderscore(String str) {
*/
private static String toCamelCase(String str, boolean lowerCaseFirstLetter) {
boolean allUpperCase = true;
for (char c : str.toCharArray()) {
if(Character.isLowerCase(c)) {
final int strLength = str.length();
for (int i = 0; i < strLength; i++) {
final char c = str.charAt(i);
if (Character.isLowerCase(c)) {
allUpperCase = false;
break;
}
}
if(allUpperCase) {
if (allUpperCase) {
str = str.toLowerCase();
}

StringBuilder sb = new StringBuilder(str.length());
StringBuilder sb = new StringBuilder(strLength);
for (String s : CAMEL_CASE_SPLIT.split(str)) {
String capitalize = StringUtils.capitalize(s);
sb.append(capitalize);
Expand Down

0 comments on commit b95f117

Please sign in to comment.