Swift newbie here. I am trying to convert some of my python code to swift and im stuck at the point where I need to split a string of letters into and array with each item being 3 letters:
For example my python code is as follows:
name = "ATAGASSTSSGASTA"
threes =[]
for start in range(0, len(name),3):
threes.append(name[start : start + 3])
print threes
For swift ive come as far as this:
var name = "ATAGASSTSSGASTA"
let namearr = Array(name)
let threes = []
threes.append(namearr[0...3])
This gives me an error.
I realize there may be an much easier way to do this, but I have not been able to find anything in my research. Any help is appreciated!