splash/Sources/Splash/Extensions/Strings/Substring+HasSuffix.swift

17 lines
318 B
Swift
Raw Normal View History

2018-08-24 18:42:07 +02:00
import Foundation
#if os(Linux)
internal extension Substring {
func hasSuffix(_ suffix: String) -> Bool {
guard count >= suffix.count else {
return false
}
let startIndex = index(endIndex, offsetBy: -suffix.count)
return self[startIndex...] == suffix
}
}
#endif