Commit 563b3f59 authored by Drew's avatar Drew

utf8 collections can't be negative-indexed

For some reason (??) this collection isn't bidirectional (or not anymore?)
parent 4a9eae46
Pipeline #2192 passed with stages
in 2 minutes and 9 seconds
......@@ -14,7 +14,7 @@
extension String {
func hasSuffix(_ str: String) -> Bool {
let view = self.utf8[self.utf8.index(self.utf8.endIndex, offsetBy: -str.utf8.count)..<self.utf8.endIndex]
let view = self.utf8[self.utf8.index(self.utf8.startIndex, offsetBy: self.utf8.count - str.utf8.count)..<self.utf8.endIndex]
var strIndex = str.utf8.startIndex
for char in view {
if char != str.utf8[strIndex] { return false }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment