8000 update · githubcs/Java-Coding-Problems@3fd73d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3fd73d5

Browse files
committed
update
1 parent c155f8e commit 3fd73d5

File tree

1 file changed

+3
-3
lines changed
  • Chapter_01/P06_CountOccurrencesOfCharacter/src/modern/challenge

1 file changed

+3
-3
lines changed

Chapter_01/P06_CountOccurrencesOfCharacter/src/modern/challenge/Strings.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static int countOccurrencesOfACertainCharacterVCP1(String str, String ch)
2323
return< 8000 /span> -1;
2424
}
2525

26-
if (ch.codePointCount(0, ch.length()) != 1) {
26+
if (ch.codePointCount(0, ch.length()) > 1) {
2727
return -1; // there is more than 1 Unicode character in the given String
2828
}
2929

@@ -56,7 +56,7 @@ public static int countOccurrencesOfACertainCharacterVCP2(String str, String ch)
5656
return -1;
5757
}
5858

59-
if (ch.codePointCount(0, ch.length()) != 1) {
59+
if (ch.codePointCount(0, ch.length()) > 1) {
6060
return -1; // there is more than 1 Unicode character in the given String
6161
}
6262

@@ -90,7 +90,7 @@ public static long countOccurrencesOfACertainCharacterVCP3(String str, String ch
9090
return -1;
9191
}
9292

93-
if (ch.codePointCount(0, ch.length()) != 1) {
93+
if (ch.codePointCount(0, ch.length()) > 1) {
9494
return -1; // there is more than 1 Unicode character in the given String
9595
}
9696

0 commit comments

Comments
 (0)
0