aboutsummaryrefslogtreecommitdiff
path: root/src/StringUtils.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-07-26 20:45:16 +0200
committerdec05eba <dec05eba@protonmail.com>2021-07-26 20:45:16 +0200
commitdda3bcd3bd228da1fb18ac1786b690270bf391f0 (patch)
tree511f82e5a7bbed573e3059f4428b345e561535c5 /src/StringUtils.cpp
parent2ed4776bb1d49ab420dd4abded8a34f99d31e4d4 (diff)
Matrix: greatly improve performance when entering a very large room (initially and later on)
Diffstat (limited to 'src/StringUtils.cpp')
-rw-r--r--src/StringUtils.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp
index 8ed142f..041a12d 100644
--- a/src/StringUtils.cpp
+++ b/src/StringUtils.cpp
@@ -109,4 +109,24 @@ namespace QuickMedia {
return std::string::npos;
return it - str.begin();
}
+
+ static char to_upper(char c) {
+ if(c >= 'a' && c <= 'z')
+ return c - 32;
+ else
+ return c;
+ }
+
+ 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;
+ }
+ }
} \ No newline at end of file