javascript读取本地TXT文档中数据,并将数据存入二维数组中
本地aa.txt文件中数据格式如下
120.11,40.22,108,1008,18,0
120.11,40.22,108,1008,18,0
120.11,40.22,108,1008,18,0
120.11,40.22,108,1008,18,0
希望转换成
[[120.11,40.22,108,1008,18,0],
[120.11,40.22,108,1008,18,0],
[120.11,40.22,108,1008,18,0],
[120.11,40.22,108,1008,18,0]]
代码如下 只能实现按照换行 转换成一个数组,
目前按照行读取为一维数组 ["120.11,40.22,108,1008,18,0""120.11,40.22,108,1008,18,0""120.11,40.22,108,1008,18,0","120.11,40.22,108,1008,18,0"] 不是想要的内容 求指点 最好能附上代码 谢谢
每五个一组?那就循环校验下,每五个就重新放一个array里边,然后最后再把所有array放到外层里边