frankakn_7 frankakn_7 - 7 months ago 15
iOS Question

How to determine word length in swift

let word : String = "hello"

var wordLength : Int = word.length //what to do here ?

for i in wordLength {
let index = word.startIndex.advancedBy(i)

I want to print all the characters of the variable word individually, but i don't know how to determine when the word is over, or how often i have to loop until the whole word was printed.

let word = "hello"

for i in word.characters {