[Glacier] Add a StringView class and StrSplit method.
This commit is contained in:
parent
b6c220a350
commit
a2e80952c8
8 changed files with 159 additions and 4 deletions
|
|
@ -26,6 +26,8 @@ String::String(const char* cstr, uint64_t str_len) : length_(str_len) {
|
|||
cstr_[length_] = '\0';
|
||||
}
|
||||
|
||||
String::String(StringView str) : String(str.data(), str.size()) {}
|
||||
|
||||
bool String::operator==(const String& other) {
|
||||
if (other.length_ != length_) {
|
||||
return false;
|
||||
|
|
@ -43,4 +45,6 @@ char String::operator[](uint64_t offset) const {
|
|||
return cstr_[offset];
|
||||
}
|
||||
|
||||
String::operator StringView() const { return StringView(cstr_, length_); }
|
||||
|
||||
} // namespace glcr
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue