mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-28 10:20:04 +02:00
Fix EndsWidth crash when the suffix is longer than *this
This commit is contained in:
@@ -244,7 +244,7 @@ public:
|
|||||||
inline bool Contains(ByteString const &other) const { return super::find(other) != npos; }
|
inline bool Contains(ByteString const &other) const { return super::find(other) != npos; }
|
||||||
|
|
||||||
inline bool BeginsWith(ByteString const &other) const { return !super::compare(0, other.size(), other); }
|
inline bool BeginsWith(ByteString const &other) const { return !super::compare(0, other.size(), other); }
|
||||||
inline bool EndsWith(ByteString const &other) const { return !super::compare(size() - other.size(), other.size(), other); }
|
inline bool EndsWith(ByteString const &other) const { return size() >= other.size() && !super::compare(size() - other.size(), other.size(), other); }
|
||||||
|
|
||||||
using Split = SplitBase<ByteString>;
|
using Split = SplitBase<ByteString>;
|
||||||
inline Split SplitBy(value_type ch, size_t pos = 0) const { return Split(*this, pos, super::find(ch, pos), 1, false); }
|
inline Split SplitBy(value_type ch, size_t pos = 0) const { return Split(*this, pos, super::find(ch, pos), 1, false); }
|
||||||
@@ -417,7 +417,7 @@ public:
|
|||||||
inline bool Contains(String const &other) const { return super::find(other) != npos; }
|
inline bool Contains(String const &other) const { return super::find(other) != npos; }
|
||||||
|
|
||||||
inline bool BeginsWith(String const &other) const { return !super::compare(0, other.size(), other); }
|
inline bool BeginsWith(String const &other) const { return !super::compare(0, other.size(), other); }
|
||||||
inline bool EndsWith(String const &other) const { return !super::compare(size() - other.size(), other.size(), other); }
|
inline bool EndsWith(String const &other) const { return size() >= other.size() && !super::compare(size() - other.size(), other.size(), other); }
|
||||||
|
|
||||||
using Split = SplitBase<String>;
|
using Split = SplitBase<String>;
|
||||||
inline Split SplitBy(value_type ch, size_t pos = 0) const { return Split(*this, pos, super::find(ch, pos), 1, false); }
|
inline Split SplitBy(value_type ch, size_t pos = 0) const { return Split(*this, pos, super::find(ch, pos), 1, false); }
|
||||||
|
Reference in New Issue
Block a user