CSV to HTML translation: Difference between revisions

Content added Content deleted
(→‎{{header|Python}}: Add pretty picture.)
(→‎{{header|J}}: Icon and Unicon)
Line 113: Line 113:
return EXIT_SUCCESS;
return EXIT_SUCCESS;
}</lang>
}</lang>

=={{header|Icon}} and {{header|Unicon}}==

<lang Icon>procedure main(arglist)
local pchar,row,thead

pchar := &letters ++ &digits ++ '!?;. ' # printable chars

write("<TABLE>")
thead := if !arglist == "-heading" then writes else 1
while row := trim(read()) do {
thead("<THEAD>")
writes("<TR><TD>")
while *row > 0 do
row ?:= ( (=",",writes("</TD><TD>")) | writes( tab(many(pchar)) | ("&#" || ord(move(1))) ), tab(0))
write("</TD></TR>")
thead("</THEAD>")
thead := 1
}
every write("</TBODY>")
end</lang>



=={{header|J}}==
=={{header|J}}==