frankakn_7 frankakn_7 - 1 year ago 78
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.

Answer Source
let word = "hello"

for i in word.characters {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download