-2

Would it be possible to loop through each character in the string, and then place each character into an array?

I'm new to swift, and I'm trying to figure this out. Could someone write a code for this?

CheeseFerrari
  • 57
  • 1
  • 7
  • you can get the answer if you refer this swift tutorial https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html – Praveen Kumar May 12 '17 at 08:36

1 Answers1

0

It's really simple:

let str = "My String"
let letters = str.characters.map({String($0)})
print(letters)
Grzegorz Krukowski
  • 18,081
  • 5
  • 50
  • 71