summaryrefslogtreecommitdiff
path: root/Source/Core/Common/StringUtil.cpp
diff options
context:
space:
mode:
authorSepalani <sepalani@hotmail.fr>2017-06-06 05:08:51 +0100
committerSepalani <sepalani@hotmail.fr>2017-06-06 05:08:51 +0100
commitf28f23af1d613670c1ed5fc28e826544f5494333 (patch)
tree99311976289a7f12c1a5c1b8fc65eaa7dd4f3908 /Source/Core/Common/StringUtil.cpp
parent12099590127ed3d779e3e614193ac13ba6faf267 (diff)
StringUtil: StringPopBackIf added
Diffstat (limited to 'Source/Core/Common/StringUtil.cpp')
-rw-r--r--Source/Core/Common/StringUtil.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp
index 80c74ac8a7..6548205fb0 100644
--- a/Source/Core/Common/StringUtil.cpp
+++ b/Source/Core/Common/StringUtil.cpp
@@ -405,6 +405,12 @@ bool StringEndsWith(const std::string& str, const std::string& end)
return str.size() >= end.size() && std::equal(end.rbegin(), end.rend(), str.rbegin());
}
+void StringPopBackIf(std::string* s, char c)
+{
+ if (!s->empty() && s->back() == c)
+ s->pop_back();
+}
+
#ifdef _WIN32
std::string UTF16ToUTF8(const std::wstring& input)