我有以下 3x3 数组:
grid = [["1","2","3"],["4","5","6"],["7","8","9"]]
我想将每个数字从 String 转换为 Fixnum。我试过了:
grid.each{ |thing| thing.each { |subthing| subthing = subthing.to_i }}
但是,puts grid[0][0].class
仍然输出String
.
我有以下 3x3 数组:
grid = [["1","2","3"],["4","5","6"],["7","8","9"]]
我想将每个数字从 String 转换为 Fixnum。我试过了:
grid.each{ |thing| thing.each { |subthing| subthing = subthing.to_i }}
但是,puts grid[0][0].class
仍然输出String
.