[REBOL] Re: Merging cells from two lines
From: arolls::bigpond::net::au at: 25-Aug-2001 15:58
You should combine the two lines, then convert
the tabs to html as you have done already.
Combining the lines:
You need to read two lines at a time.
(I am assuming each line is separated by a newline).
;block: read/lines %file.txt ; gives you a block of strings
;example block
block: ["MMEA^-LAMA^-GUAD^-GUAD" "SHER^-BATT^-CONG^-WMCA"]
foreach [s1 s2] block [
;print [s1 s2]
; split by whitespace (includes tab) and return a block
b1: parse s1 ""
b2: parse s2 ""
; combine s1 and s2
s: copy ""
repeat n length? b1 [
append s reduce [b1/:n " " b2/:n tab]
]
probe s: copy/part s back tail s ; chop off last tab
; now perform your conversion of tabs to html as below
]