diff options
Diffstat (limited to 'AK/StringUtils.h')
-rw-r--r-- | AK/StringUtils.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/AK/StringUtils.h b/AK/StringUtils.h index 7c532175c3..849be54d18 100644 --- a/AK/StringUtils.h +++ b/AK/StringUtils.h @@ -42,9 +42,23 @@ enum class TrimMode { Both }; +struct MaskSpan { + size_t start; + size_t length; + + bool operator==(const MaskSpan& other) const + { + return start == other.start && length == other.length; + } + bool operator!=(const MaskSpan& other) const + { + return !(*this == other); + } +}; + namespace StringUtils { -bool matches(const StringView& str, const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive); +bool matches(const StringView& str, const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive, Vector<MaskSpan>* match_spans = nullptr); Optional<int> convert_to_int(const StringView&); Optional<unsigned> convert_to_uint(const StringView&); Optional<unsigned> convert_to_uint_from_hex(const StringView&); |