/*
;作者:QQ1576157
;时间:2017年1月7日21:25:23
; 功能: 解析CSV文件示例,每一列存到一个数组中。
;原理:遍历每一行,将每行分成多个列
*/
data =
(join`r`n
type,make,model,specs,url
car,GM,Impala,4 door,go to www.chevy.com for selections
truck,Nissan,Titan,2WD,go to www.nissan.com for selections
truck,Toyota,Tacoma,4WD,go to www.toyota.com for selections
car,GM,Malibu,4 door,go to www.chevy.com for selections
car,Ford,Focus,2 door,go to www.ford.com for selections
car,Toyota,Corolla,4 door,go to www.toyota.com for selections
car,GM,Malibu,2 door,go to www.chevy.com for selections
truck,Toyota,Tacoma,2WD,go to www.toyota.com for selections
)
FileDelete,csvfile.csv
FileAppend,%data%,csvfile.csv
csvfile=csvfile.csv
col1:=[]
col2:=[]
col3:=[]
col4:=[]
col5:=[]
loop, read,%csvfile%
{
LineNumber = %A_Index%
loop, parse, A_LoopReadLine, CSV
col%A_Index%[LineNumber]:=A_LoopField
}
;输出检测
for k,v in col1
s.=v . "`n"
MsgBox % s
return