mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
AK: Add case insensitive String::ends_with support
FileSystemPath::has_extension was jumping through hoops and allocating memory to do a case insensitive comparison needlessly. Extend the existing String::ends_with method to allow the caller to specify the case sensitivity required.
This commit is contained in:
parent
8e4b858b3f
commit
332f96e7ca
Notes:
sideshowbarker
2024-07-19 06:07:40 +09:00
Author: https://github.com/bgianfo
Commit: 332f96e7ca
Pull-request: https://github.com/SerenityOS/serenity/pull/2387
Reviewed-by: https://github.com/awesomekling
7 changed files with 53 additions and 12 deletions
|
@ -278,9 +278,9 @@ bool String::starts_with(char ch) const
|
|||
return characters()[0] == ch;
|
||||
}
|
||||
|
||||
bool String::ends_with(const StringView& str) const
|
||||
bool String::ends_with(const StringView& str, CaseSensitivity case_sensitivity) const
|
||||
{
|
||||
return StringUtils::ends_with(*this, str);
|
||||
return StringUtils::ends_with(*this, str, case_sensitivity);
|
||||
}
|
||||
|
||||
bool String::ends_with(char ch) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue