This is what I've been doing to change a single letter at a specific location in a word:let word = "abc"
var letters = Array(word.characters)
letters[1] = "x"
let newWord = String(letters)Surely there's a more elegant way in Swift 3. But is this really it?let index = word.index(word.startIndex, offsetBy: 1)
let range = index ..< word.index(after: index)
word.replacingCharacters(in: range, with: "x")It works; but it looks hideous.
4
0
2.8k