Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


CSV to TAB List Conversion.wbt

Keywords: 	 CSV to TAB list conversion

#DefineFunction CSV2TAB(csv)
   newline=""
   inquote=0
   csvlen=strlen(csv)
   for xx=1 to csvlen
      char=strsub(csv,xx,1)
      if char=='"'
          if inquote==0 then inquote=1
          else inquote=0
          continue
      else
          if char==',' && inquote==0 then char=@tab
      endif
      newline=strcat(newline,char)
   next
   return(newline)
#EndFunction


csvline='aaa,bbb,"ddd, fff",123,"dfdfdf"'

tabline=CSV2TAB(csvline)

Message(csvline,tabline)




Article ID:   W14989