import Foundation public extension String { func index(from: Int) -> Index { return self.index(startIndex, offsetBy: from) } func substring(from: Int) -> String { let fromIndex = index(from: from) return String(self[fromIndex...]) } func substring(to: Int) -> String { let toIndex = index(from: to) return String(self[..) -> String { let startIndex = index(from: r.lowerBound) let endIndex = index(from: r.upperBound) return String(self[startIndex..