We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eb8405b commit a288ec3Copy full SHA for a288ec3
src/textEditor/Capitalizer.java
@@ -6,16 +6,16 @@ public String capitalize(String s) {
6
if (s.length() > 0) {
7
sb.append(Character.toUpperCase(s.charAt(0)));
8
}
9
- boolean foundTheEndOfLine = false;
+ boolean foundTheEndOfSentence = false;
10
for (int i = 1; i < s.length(); i++) {
11
- if (foundTheEndOfLine && !Character.isSpaceChar(s.charAt(i))) {
+ if (foundTheEndOfSentence && !Character.isWhitespace(s.charAt(i))) {
12
sb.append(Character.toUpperCase(s.charAt(i)));
13
- foundTheEndOfLine = false;
+ foundTheEndOfSentence = false;
14
} else {
15
sb.append(s.charAt(i));
16
17
if (s.charAt(i) == '.') {
18
- foundTheEndOfLine = true;
+ foundTheEndOfSentence = true;
19
20
21
return sb.toString();
0 commit comments