util/StringView: add {Starts,Ends}With(char)
This commit is contained in:
parent
1f312b2e42
commit
937da63ba6
@ -154,6 +154,16 @@ struct BasicStringView : ConstBuffer<T> {
|
||||
needle.data, needle.size);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
bool StartsWith(value_type ch) const noexcept {
|
||||
return !empty() && front() == ch;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
bool EndsWith(value_type ch) const noexcept {
|
||||
return !empty() && back() == ch;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
int Compare(BasicStringView<T> other) const noexcept {
|
||||
if (size < other.size) {
|
||||
|
Loading…
Reference in New Issue
Block a user