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:
parent
50e9000b40
commit
5fbec2b003
6 changed files with 56 additions and 47 deletions
12
AK/String.h
12
AK/String.h
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue