How can I convert the "numbersString" array that has String type values to a "numbersFloat" array with float type values
The problem is that I keep getting "Cannot assign value of type 'String' to subscript of type 'Double'" as an error
I understand that I am not able to input a Float value to a String subscript, but I can't neither change the Strings because they are comma separated and can't put the values in the array
var numbersString = [["564,00", "577,00", "13,00"], ["563,00", "577,00", "14,00"]] → I have
var numbersFloat = [[564.00, 577.00, 13.00], [563.00, 577.00, 14.00]] → I need
Things I have tried:
for row in 0...numbersString.count-1 {
for col in 0...numbersString[0].count-1 {
numbersFloat[row][col] = numbersString[row][col]
}
}
Error: Cannot assign value of type 'String' to subscript of type 'Double'
for row in 0...numbersString.count-1 {
for col in 0...numbersString[0].count-1 {
var a = table[row][col]
table[row][col] = Float(a)
}
}