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

AK: Replace String::trim_spaces() with String::trim_whitespace()

As suggested by @awesomekling in a code review and (initially) ignored
by me :^)

Implementation is roughly based on LibJS's trim_string(), but with a fix
for trimming all-whitespace strings.
This commit is contained in:
Linus Groh 2020-05-13 00:20:52 +01:00 committed by Andreas Kling
parent 0c14ee035c
commit 1febee768d
3 changed files with 41 additions and 12 deletions

View file

@ -114,7 +114,12 @@ public:
String to_lowercase() const;
String to_uppercase() const;
String trim_spaces() const;
enum class TrimMode {
Left,
Right,
Both
};
String trim_whitespace(TrimMode mode = TrimMode::Both) const;
bool equals_ignoring_case(const StringView&) const;