diff options
author | darkf <lw9k123@gmail.com> | 2014-12-29 19:47:41 -0800 |
---|---|---|
committer | darkf <lw9k123@gmail.com> | 2014-12-29 19:47:41 -0800 |
commit | 8ba9ac0f74abb0408a26207a76a0c1808bad8de0 (patch) | |
tree | f1c7c3393fa726435b5b90bf335567c93e528ef1 /src/common/string_util.h | |
parent | a19354acedbfeafd28219c48a1ec32f76dd17a54 (diff) | |
parent | 3d14eb285382740b144e5b047cb2ad072f6129ea (diff) |
Fix merge conflicts
Diffstat (limited to 'src/common/string_util.h')
-rw-r--r-- | src/common/string_util.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/common/string_util.h b/src/common/string_util.h index ae5bbadad9..74974263fb 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h @@ -1,5 +1,5 @@ -// Copyright 2013 Dolphin Emulator Project -// Licensed under GPLv2 +// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project +// Licensed under GPLv2 or any later version // Refer to the license.txt file included. #pragma once @@ -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'); +} + } |