mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 09:20:28 +03:00
AK: Add trim_ascii_whitespace method to String
This commit is contained in:
parent
bc8cad31de
commit
a94c0eea94
Notes:
sideshowbarker
2024-07-17 07:25:39 +09:00
Author: https://github.com/aryanbaburajan Commit: https://github.com/SerenityOS/serenity/commit/a94c0eea94 Pull-request: https://github.com/SerenityOS/serenity/pull/19687 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/LucasChollet Reviewed-by: https://github.com/gmta ✅ Reviewed-by: https://github.com/linusg
@ -484,6 +484,11 @@ ErrorOr<String> String::trim(StringView code_points_to_trim, TrimMode mode) cons
|
||||
return trim(Utf8View { code_points_to_trim }, mode);
|
||||
}
|
||||
|
||||
ErrorOr<String> String::trim_ascii_whitespace(TrimMode mode) const
|
||||
{
|
||||
return trim(" \n\t\v\f\r"sv, mode);
|
||||
}
|
||||
|
||||
bool String::contains(StringView needle, CaseSensitivity case_sensitivity) const
|
||||
{
|
||||
return StringUtils::contains(bytes_as_string_view(), needle, case_sensitivity);
|
||||
|
@ -150,6 +150,7 @@ public:
|
||||
|
||||
ErrorOr<String> trim(Utf8View const& code_points_to_trim, TrimMode mode = TrimMode::Both) const;
|
||||
ErrorOr<String> trim(StringView code_points_to_trim, TrimMode mode = TrimMode::Both) const;
|
||||
ErrorOr<String> trim_ascii_whitespace(TrimMode mode = TrimMode::Both) const;
|
||||
|
||||
ErrorOr<Vector<String>> split_limit(u32 separator, size_t limit, SplitBehavior = SplitBehavior::Nothing) const;
|
||||
ErrorOr<Vector<String>> split(u32 separator, SplitBehavior = SplitBehavior::Nothing) const;
|
||||
|
Loading…
Reference in New Issue
Block a user