1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +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:
Brian Gianforcaro 2020-05-26 02:12:18 -07:00 committed by Andreas Kling
parent 8e4b858b3f
commit 332f96e7ca
7 changed files with 53 additions and 12 deletions

View file

@ -146,7 +146,7 @@ public:
ConstIterator end() const { return begin() + length(); }
bool starts_with(const StringView&) const;
bool ends_with(const StringView&) const;
bool ends_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
bool starts_with(char) const;
bool ends_with(char) const;