09-14-2010, 01:03 PM
Maybe better to use CSV format. Because tok would ignore empty words.
Macro Macro1431
Macro Macro1431
;input string (2 lines)
str s=
;hello|goodbey|welcome|light|dark
;hello||welcome|light|dark
;split
ICsv x=CreateCsv
x.Separator="|"
x.FromString(s)
;replace second word in each line
int i
for i 0 x.RowCount
,x.Cell(i 1)="replaced"
;results
for i 0 x.RowCount
,out "%s, %s, %s, %s, %s" x.Cell(i 0) x.Cell(i 1) x.Cell(i 2) x.Cell(i 3) x.Cell(i 4)