Function Split (Str,splitor) if (splitor==nil) then splitor= ", End local strarray={} Local Strstart=1 Local Splitorlen = String.len (splitor) Local Index=string.find (str,splitor,strstart,tr
UE) if (index==nil) then strarray[1]=str return Strarray end local I=1 While the index do Strarray[i]=string.sub (str,strstart,index-1) i=i+1 Strstart=index+split Orlen index = string.find (str,splitor,strstart,true) End Strarray[i]=string.sub (str,strstart,s Tring.len (str)) return Strarray end-double and single quotation mark function Sf_trim (s) Local _, Q Uotedpart = String.match (S, "[[\"]) (.-)%1 ") Return to Quotedpart End Function Arrtotabstr (Tbstrarr, Tbcol) Local szoutput = "" Nfirstline = 1 for _, Ncol in pairs (tbcol) do if TBSTRARR[NC
OL] ~= Nil Then if nfirstline = = 1 Then szoutput = Szoutput. Sf_trim (Tbstrarr[ncol]) nfirstline = 0 Else Szoutput = szoutput ... ' \ t '.. Sf_trim (Tbstrarr[ncol]) end end szoutput = Szoutput.
\ n ' Return Szoutput end--[[would have listened to Peikai's comments, ready to add another block list, but this tool is only for their own use, the trouble is only once, don't worry about. ] Function Fcsvtotabfile (Szfilepath, Tbselcol)--open csv file local Tbret = {} Local hcsvfile = IO
. Open (Szfilepath) if not Hcsvfile then print ("Cannot open the specified file:", Szfilepath) return end --Creates the Output tab file local Htabfile = Io.open ("Test.txt", "w") if not Htabfile then PRI NT ("Cannot create output file") return end local Nlinenum = 0 while 1 does line = Hcsvfi
Le:read ("*l") if not line then the break end; Local STROUTPUt = arrtotabstr (split (line), Tbselcol) if Stroutput ~= "" Then Htabfile:write (stroutput) End nlinenum = nlinenum + 1 End hcsvfile:close () Htabfile:close () end