diff options
author | crupest <crupest@outlook.com> | 2022-01-08 19:24:44 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-01-08 19:24:44 +0800 |
commit | 0c7153db084060034092c1dc24222cae384722ec (patch) | |
tree | 9de1bc4636732e3cc1e1fb7309fdf2ff60683f69 /include/cru/common/String.hpp | |
parent | c38f1f7c273e85c0a6d197cb27424c9ca69e234d (diff) | |
download | cru-0c7153db084060034092c1dc24222cae384722ec.tar.gz cru-0c7153db084060034092c1dc24222cae384722ec.tar.bz2 cru-0c7153db084060034092c1dc24222cae384722ec.zip |
...
Diffstat (limited to 'include/cru/common/String.hpp')
-rw-r--r-- | include/cru/common/String.hpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/cru/common/String.hpp b/include/cru/common/String.hpp index 86e0a134..0ae223cf 100644 --- a/include/cru/common/String.hpp +++ b/include/cru/common/String.hpp @@ -165,7 +165,10 @@ class CRU_BASE_API String { } inline void append(StringView str); - String substr(size_type start, size_type size) const { + String substr(size_type start, size_type size = -1) const { + if (size == -1) { + size = this->size_ - start; + } return String(this->buffer_ + start, size); } @@ -189,6 +192,9 @@ class CRU_BASE_API String { std::vector<String> SplitToLines(bool remove_space_line = false) const; + bool StartWith(StringView str) const; + bool EndWith(StringView str) const; + public: void AppendCodePoint(CodePoint code_point); |