From 18099ad8f5c24b1c2b1c92238dbc54912eab0406 Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 2 Jan 2022 18:49:31 +0800 Subject: ... --- src/common/String.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/common/String.cpp') diff --git a/src/common/String.cpp b/src/common/String.cpp index 743a33fd..8d674369 100644 --- a/src/common/String.cpp +++ b/src/common/String.cpp @@ -211,6 +211,15 @@ String::iterator String::erase(const_iterator start, const_iterator end) { return s; } +String& String::TrimEnd() { + if (size_ == 0) return *this; + while (size_ > 0 && IsWhitespace(buffer_[size_ - 1])) { + size_--; + } + + return *this; +} + std::string String::ToUtf8() const { return cru::ToUtf8(buffer_, size_); } void String::AppendCodePoint(CodePoint code_point) { -- cgit v1.2.3