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:
parent
0c14ee035c
commit
1febee768d
3 changed files with 41 additions and 12 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue