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

AK: Add a somewhat naive implementation of String::reverse

This will reverse the String's code points (i.e. not just its bytes),
but is not aware of grapheme clusters.
This commit is contained in:
Timothy Flynn 2023-01-13 11:34:00 -05:00 committed by Linus Groh
parent f5d253dcfa
commit 9db9b2f9be
3 changed files with 38 additions and 0 deletions

View file

@ -69,6 +69,7 @@ public:
[[nodiscard]] StringView bytes_as_string_view() const;
ErrorOr<String> replace(StringView needle, StringView replacement, ReplaceMode replace_mode) const;
ErrorOr<String> reverse() const;
[[nodiscard]] bool operator==(String const&) const;
[[nodiscard]] bool operator!=(String const& other) const { return !(*this == other); }