mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
AK: Add a Swift helper for StringView::ends_with
This commit is contained in:
parent
b895a135d5
commit
e0adbf3ebb
Notes:
github-actions[bot]
2024-11-15 17:56:57 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/e0adbf3ebbe Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2350
1 changed files with 7 additions and 0 deletions
|
@ -29,4 +29,11 @@ extension AK.StringView: ExpressibleByStringLiteral {
|
||||||
public init(stringLiteral value: StringLiteralType) {
|
public init(stringLiteral value: StringLiteralType) {
|
||||||
self.init(value.utf8Start, value.utf8CodeUnitCount)
|
self.init(value.utf8Start, value.utf8CodeUnitCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func endsWith(_ suffix: AK.StringView) -> Bool {
|
||||||
|
if suffix.length() == 1 {
|
||||||
|
return self.ends_with(suffix[0])
|
||||||
|
}
|
||||||
|
return self.ends_with(suffix, AK.CaseSensitivity.sensitive)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue