This is how you walk through a string in Swift 3:
let str = "Hello, playground"
let stepsize = 3
let len = str.characters.count for start in stride(from: 0, to: len, by: stepsize) {
var end = start + stepsize
if end > len {
end = len
}
let startIndex = str.index(str.startIndex, offsetBy: start)
let endIndex = str.index(str.startIndex, offsetBy: end) print("From \(start) to \(end)")
print(str[startIndex..<endIndex])
}Note: not optimized in any way.