##Swift 2.0 Simple
let str = "My String" let subStr = str[str.startIndex.advancedBy(3)...str.startIndex.advancedBy(7)] //"Strin" ##Swift 3
let startIndex = str.index(str.startIndex, offsetBy: 3) let endIndex = str.index(str.startIndex, offsetBy: 7) str[startIndex...endIndex] // "Strin" str.substring(to: startIndex) // "My " str.substring(from: startIndex) // "String" ##Swift 4
substring(to:) and substring(from:) are deprecated in Swift 4.
str[..<startIndex] // "My " str[startIndex...] // "String" str[startIndex...endIndex] // "Strin"