swift 3
// from
string.substring(from: range.lowerBound)
// to
string.substring(to: range.upperBound)
//with
string.substring(with: range)
swift 4
// from
String(string[range.lowerBound...])
String(string.suffix(from: range.lowerBound))
// to
String(string[..<range.upperBound])
String(string.prefix(upTo: range.upperBound))
// with
String(string[range])
网友评论