I'm trying to parse a string into an N × M array of array of characters. For example - given the following:
let string = "ABCDEF" + "GHIJKL" + "MNOPQR"
I'd like to convert to this:
[
["A", "B", "C", "D", "E", "F"],
["G", "H", "I", "J", "K", "L"],
["M", "N", "O", "P", "Q", "R"],
]
I noticed using Array(string.characters)
gives me a one dimension array. Does a Swift function exist to group a one dimensional array? Is it possible to convert the string directly into a multi dimensional array?