mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:07:36 +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
|
@ -36,6 +36,12 @@ enum class CaseSensitivity {
|
|||
CaseSensitive,
|
||||
};
|
||||
|
||||
enum class TrimMode {
|
||||
Left,
|
||||
Right,
|
||||
Both
|
||||
};
|
||||
|
||||
namespace StringUtils {
|
||||
|
||||
bool matches(const StringView& str, const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive);
|
||||
|
@ -45,8 +51,10 @@ Optional<unsigned> convert_to_uint_from_hex(const StringView&);
|
|||
bool equals_ignoring_case(const StringView&, const StringView&);
|
||||
bool ends_with(const StringView& a, const StringView& b, CaseSensitivity);
|
||||
bool starts_with(const StringView&, const StringView&, CaseSensitivity);
|
||||
StringView trim_whitespace(const StringView&, TrimMode mode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
using AK::CaseSensitivity;
|
||||
using AK::TrimMode;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue