How can I get the nth character of a string? I tried bracket([]) accessor with no luck.
[]
var string = \"Hello, world!\" var firstChar = string[
My solution is in one line, supposing cadena is the string and 4 is the nth position that you want:
let character = cadena[advance(cadena.startIndex, 4)]
Simple... I suppose Swift will include more things about substrings in future versions.