From f28f23af1d613670c1ed5fc28e826544f5494333 Mon Sep 17 00:00:00 2001 From: Sepalani Date: Tue, 6 Jun 2017 05:08:51 +0100 Subject: StringUtil: StringPopBackIf added --- Source/Core/Common/StringUtil.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Source/Core/Common/StringUtil.cpp') 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) -- cgit v1.2.3