Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie. Split string. Replace.
#4
Maybe better to use CSV format. Because tok would ignore empty words.

Macro Macro1431
Code:
Copy      Help
;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)


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)