diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-02 16:36:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-03 16:30:01 +0200 |
commit | 8bf380f7d33f39eaa4cb96b38a82ac18e589deef (patch) | |
tree | 64b6809f8fe45243a762095d903f91cb093ecf77 /include | |
parent | a56474374b7a5aeacf41419fc1a6c99007cd7483 (diff) |
add o3tl::matchIgnoreAsciiCase
Change-Id: Iad8e1ed256d84808404bf20ed7a16b05b3db5818
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133753
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/o3tl/string_view.hxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/o3tl/string_view.hxx b/include/o3tl/string_view.hxx index 0935844349e2..026dc5e167ae 100644 --- a/include/o3tl/string_view.hxx +++ b/include/o3tl/string_view.hxx @@ -54,6 +54,15 @@ inline int compareToIgnoreAsciiCase(std::u16string_view s1, std::u16string_view return rtl_ustr_compareIgnoreAsciiCase_WithLength(s1.data(), s1.size(), s2.data(), s2.size()); }; +// Like OUString::matchIgnoreAsciiCase, but for two std::u16string_view: +inline bool matchIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2, + sal_Int32 fromIndex = 0) +{ + return rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( + s1.data() + fromIndex, s1.size() - fromIndex, s2.data(), s2.size(), s2.size()) + == 0; +} + // Similar to O[U]String::getToken, returning the first token of a std::[u16]string_view starting // at a given position. // |