summaryrefslogtreecommitdiff
path: root/src/common/string_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/string_util.h')
-rw-r--r--src/common/string_util.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/common/string_util.h b/src/common/string_util.h
index ae5bbadad..74974263f 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#pragma once 5#pragma once
@@ -115,4 +115,19 @@ inline std::string UTF8ToTStr(const std::string& str)
115 115
116#endif 116#endif
117 117
118/**
119 * Compares the string defined by the range [`begin`, `end`) to the null-terminated C-string
120 * `other` for equality.
121 */
122template <typename InIt>
123bool ComparePartialString(InIt begin, InIt end, const char* other) {
124 for (; begin != end && *other != '\0'; ++begin, ++other) {
125 if (*begin != *other) {
126 return false;
127 }
128 }
129 // Only return true if both strings finished at the same point
130 return (begin == end) == (*other == '\0');
131}
132
118} 133}