1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:27:34 +00:00

AK+LibUnicode: Provide Unicode-aware caseless String matching

The Unicode spec defines much more complicated caseless matching
algorithms in its Collation spec. This implements the "basic" case
folding comparison.
This commit is contained in:
Timothy Flynn 2023-01-17 11:30:10 -05:00 committed by Linus Groh
parent 8f2589b3b0
commit 537fcaf59e
3 changed files with 79 additions and 0 deletions

View file

@ -49,6 +49,10 @@ public:
ErrorOr<String> to_lowercase(Optional<StringView> const& locale = {}) const;
ErrorOr<String> to_uppercase(Optional<StringView> const& locale = {}) const;
ErrorOr<String> to_titlecase(Optional<StringView> const& locale = {}) const;
ErrorOr<String> to_casefold() const;
// Compare this String against another string with caseless matching. Using this method requires linking LibUnicode into your application.
ErrorOr<bool> equals_ignoring_case(String const&) const;
// Creates a substring with a deep copy of the specified data window.
ErrorOr<String> substring_from_byte_offset(size_t start, size_t byte_count) const;