[Solved] How to return an subset of Array of characters?


You need to map the Character array back to String

let resultsArray = lettersarray.dropLast(lettersarray.count - targetNum).map{String($0)}

alternatively (credits to Leo Dabus)

let letters = "abcdefghijklmnopqrstuvwxyz"
let targetNum = 14
let resultsArray = letters.characters.prefix(targetNum).map{String($0)}

4

solved How to return an subset of Array of characters?