diff options
Diffstat (limited to 'include/cru/common')
-rw-r--r-- | include/cru/common/String.hpp | 8 | ||||
-rw-r--r-- | include/cru/common/StringUtil.hpp | 2 |
2 files changed, 8 insertions, 2 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); diff --git a/include/cru/common/StringUtil.hpp b/include/cru/common/StringUtil.hpp index a35da695..a0cb6b0b 100644 --- a/include/cru/common/StringUtil.hpp +++ b/include/cru/common/StringUtil.hpp @@ -222,5 +222,5 @@ Index CRU_BASE_API Utf16NextWord(const char16_t* ptr, Index size, char16_t CRU_BASE_API ToLower(char16_t c); char16_t CRU_BASE_API ToUpper(char16_t c); -char16_t CRU_BASE_API IsWhitespace(char16_t c); +bool CRU_BASE_API IsWhitespace(char16_t c); } // namespace cru |