aboutsummaryrefslogtreecommitdiff
path: root/src/common/String.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-01-02 18:49:31 +0800
committercrupest <crupest@outlook.com>2022-01-02 18:49:31 +0800
commit18099ad8f5c24b1c2b1c92238dbc54912eab0406 (patch)
tree514207d630a2100262aedaea276ea259bbc108b7 /src/common/String.cpp
parent96a93e17baaff2c2050eba2afada639e93001232 (diff)
downloadcru-18099ad8f5c24b1c2b1c92238dbc54912eab0406.tar.gz
cru-18099ad8f5c24b1c2b1c92238dbc54912eab0406.tar.bz2
cru-18099ad8f5c24b1c2b1c92238dbc54912eab0406.zip
...
Diffstat (limited to 'src/common/String.cpp')
-rw-r--r--src/common/String.cpp9
1 files changed, 9 insertions, 0 deletions
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) {