SyntaxFix
Write A Post
Hire A Developer
Questions
You can find the index number of a character in a string with this:
var str = "abcdefghi" if let index = str.firstIndex(of: "c") { let distance = str.distance(from: str.startIndex, to: index) // distance is 2 }