Printing a line of data
[1/6] from: john:thousand-hills at: 23-Aug-2001 21:53
-- Unable to decode HTML file!! --
[2/6] from: john:thousand-hills at: 24-Aug-2001 6:04
I read a text file using this code:
data: read/lines %route.txt
It produced the line below with this code:
print pick data 4
9:54 9:57 10:03 10:06 10:12 10:20 10:23 10:27 10:34 10:43 10:48
10:56 11:06
____________________
Is there a way to print this line with code between the tab delimited groups?
Like this:
<TR><TD> 9:54 </TD><TD> 9:57 </TD><TD> 10:03 </TD></TR> etc... etc...
[3/6] from: cyphre:volny:cz at: 24-Aug-2001 14:23
Hello John,
ups! Little typo in the code :)
here is working script:
WATCH OUT LINE BREAKS!!!
-----------snip--------------------
test: {9:54 9:57 10:03
10:06 10:12 10:20 10:23 10:27
10:34 10:43 10:48}
parse/all test [some [eol: "^/" (remove eol insert eol " eol ") skip | skip]
to end]
parse to-block test [some [result: time! (insert result <td> insert skip
result 2 </td>) 2 skip | result: 'eol (remove/part result 1 insert result
[</tr><tr>]) | skip] to end]
insert head result <tr>
probe to-string head result
------------------snip----------------
have fun!
Cyphre
[4/6] from: cyphre::volny::cz at: 24-Aug-2001 14:12
Hi John,
here is my quick(15 minutes) and ugly(a bit code confusion (-: ) solution
but maybe you will find it useful:
WATCH OUT LINE BREAKS!!!
-----------snip--------------------
test: {9:54 9:57 10:03
10:06 10:12 10:20 10:23 10:27
10:34 10:43 10:48}
parse/all test [some [eol: "^/" (remove eol insert eol " eol ") skip | skip]
to end]
parse to-block test [some [result: time! (insert result <td> insert skip
result 2 </td>) 2 skip | result: 'eol (remove/part result 3 insert result
[</tr><tr>]) | skip] to end]
insert head result <tr>
probe to-string head result
------------------snip----------------
have fun!
Cyphre
[5/6] from: arolls:bigpond:au at: 24-Aug-2001 22:51
Another way:
; example tab-delimited string
s: {9:54^-9:57^-10:03^-10:06^-10:12^-10:20^-10:23^-10:27}
replace/all s tab "</td><td>"
s: rejoin ["<tr><td>" s "</td></tr>"]
[6/6] from: john:thousand-hills at: 24-Aug-2001 22:58
Anton, Richard:
The line code worked with some tweaking.
Quote:
data: read/lines %route.txt
s70: pick data 70 replace/all s70 tab "</CENTER></TD><TD><CENTER>" s70:
rejoin [ "<tr bordercolor=gold border=1 bgcolor=white><TD><CENTER>" s70
</CENTER></TD></tr>
]
either d70 [ print s70 ] [ "" ]
Unquote:
//John