jweinst1
12/31/2015 - 12:08 AM

swift functions to make new character arrays

swift functions to make new character arrays

//turns a string to array of characters
func toarray(input: String) ->[Character] {
    var letters = [Character]()
    for elem in input {
        letters.append(elem)
    }
    return letters
}

//turns an array of characters to a string.
func tostring(input: [Character]) ->String {
    var t = ""
    for elem in input {
        t += toString(elem)
    }
    return t
}