aboutsummaryrefslogtreecommitdiff
path: root/src/StringUtils.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-08-25 18:48:34 +0200
committerdec05eba <dec05eba@protonmail.com>2021-08-25 18:48:34 +0200
commit0a26a319b241978ee317bbe768eb61c4eb7a39d9 (patch)
treebfa56141b5140c1f25c81925d5fc616012bd22a3 /src/StringUtils.cpp
parent48da6508416dd80c68c9213a242a2542af2574fe (diff)
Faster mangakatana search on exact match
Diffstat (limited to 'src/StringUtils.cpp')
-rw-r--r--src/StringUtils.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp
index 5dfeca9..8a3a0ef 100644
--- a/src/StringUtils.cpp
+++ b/src/StringUtils.cpp
@@ -117,14 +117,35 @@ namespace QuickMedia {
return c;
}
+ bool strncase_equals(const char *str1, const char *str2, size_t length) {
+ size_t i = 0;
+ for(;;) {
+ if(i == length)
+ return true;
+ ++i;
+
+ const char c1 = *str1;
+ const char c2 = *str2;
+ if(to_upper(c1) != to_upper(c2))
+ return false;
+ else if(c1 == '\0')
+ return true;
+
+ ++str1;
+ ++str2;
+ }
+ }
+
bool strcase_equals(const char *str1, const char *str2) {
for(;;) {
const char c1 = *str1;
const char c2 = *str2;
+
if(to_upper(c1) != to_upper(c2))
return false;
else if(c1 == '\0')
return true;
+
++str1;
++str2;
}