Loop through characters in string

 Problem

I have a String and want to iterate through its characters.



 Recipe


// Initialize the Array
var str = "Hello World"

// Loop through its individual characters

str.characters.forEach {
    print($0)
}

				

Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)

 

 Playground