summaryrefslogtreecommitdiffstats
path: root/src/common/string_util.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2014-12-13 05:20:01 +0100
committerbunnei <bunneidev@gmail.com>2014-12-13 05:20:01 +0100
commitaf1cd769e7b407af71496e788e218add31f8b2b0 (patch)
tree1e3fd71256c04a15970b09abd3f7280f8b1ff678 /src/common/string_util.h
parentMerge pull request #267 from bunnei/apt-shared-font (diff)
parentRemove old logging system (diff)
downloadyuzu-af1cd769e7b407af71496e788e218add31f8b2b0.tar
yuzu-af1cd769e7b407af71496e788e218add31f8b2b0.tar.gz
yuzu-af1cd769e7b407af71496e788e218add31f8b2b0.tar.bz2
yuzu-af1cd769e7b407af71496e788e218add31f8b2b0.tar.lz
yuzu-af1cd769e7b407af71496e788e218add31f8b2b0.tar.xz
yuzu-af1cd769e7b407af71496e788e218add31f8b2b0.tar.zst
yuzu-af1cd769e7b407af71496e788e218add31f8b2b0.zip
Diffstat (limited to 'src/common/string_util.h')
-rw-r--r--src/common/string_util.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/common/string_util.h b/src/common/string_util.h
index ae5bbadad..7d75691b1 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -115,4 +115,19 @@ inline std::string UTF8ToTStr(const std::string& str)
#endif
+/**
+ * Compares the string defined by the range [`begin`, `end`) to the null-terminated C-string
+ * `other` for equality.
+ */
+template <typename InIt>
+bool ComparePartialString(InIt begin, InIt end, const char* other) {
+ for (; begin != end && *other != '\0'; ++begin, ++other) {
+ if (*begin != *other) {
+ return false;
+ }
+ }
+ // Only return true if both strings finished at the same point
+ return (begin == end) == (*other == '\0');
+}
+
}