How can I get the nth character of a string? I tried bracket([]) accessor with no luck.
[]
var string = \"Hello, world!\" var firstChar = string[
You can do it by convert String into Array and get it by specific index using subscript as below
var str = "Hello" let s = Array(str)[2] print(s)