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

AK: Move trim_whitespace() into StringUtils and add it to StringView

No behaviour change; also patches use of `String::TrimMode` in LibJS.
This commit is contained in:
AnotherTest 2020-09-20 18:05:04 +04:30 committed by Andreas Kling
parent 50e9000b40
commit 5fbec2b003
6 changed files with 56 additions and 47 deletions

View file

@ -119,12 +119,12 @@ public:
String to_lowercase() const;
String to_uppercase() const;
enum class TrimMode {
Left,
Right,
Both
};
String trim_whitespace(TrimMode mode = TrimMode::Both) const;
#ifndef KERNEL
String trim_whitespace(TrimMode mode = TrimMode::Both) const
{
return StringUtils::trim_whitespace(StringView { characters(), length() }, mode);
}
#endif
bool equals_ignoring_case(const StringView&) const;