Skip to content

Commit

Permalink
Removed the if-else and replaced with clearer data flow.
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost committed Nov 4, 2024
1 parent 0d0dd5a commit 0523a73
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/org/apache/commons/lang3/text/WordUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,14 @@ public static String initials(final String str, final char... delimiters) {
final char ch = str.charAt(i);
if (isDelimiter(ch, delimiters)) {
lastWasGap = true;
} else if (lastWasGap) {
continue;
}
if (lastWasGap) {
buf[count++] = ch;
lastWasGap = false;
} else {
continue; // ignore ch
}

// ignore ch
}
return new String(buf, 0, count);
}
Expand Down

0 comments on commit 0523a73

Please sign in to comment.