Jump to content

CSV to HTML translation: Difference between revisions

CSV to HTML translation en FreeBasic
(Added Wren)
(CSV to HTML translation en FreeBasic)
Line 1,851:
<tr><td>The multitude</td><td>Behold his mother! Behold his mother!</td></tr>
</Table>
 
 
=={{header|FreeBASIC}}==
<lang freebasic>Data "Character,Speech"
Data "The multitude,The messiah! Show us the messiah!"
Data "Brian's mother,<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>"
Data "The multitude,Who are you?"
Data "Brian's mother,I'm his mother; that's who!"
Data "The multitude,Behold his mother! Behold his mother!"
Data "***"
 
Print "<!DOCTYPE html>" & Chr(10) & "<html>"
Print "<head>"
Print "</head>" & Chr(10)
Print "<body>"
Print "<h1 style=""text-align:center"">CSV to html translation </h1>"
Print: Print "<table border = 1 cellpadding = 10 cellspacing = 0>"
 
Dim As Boolean header = true
Dim As String cadenaCSV, txt
Do
Read cadenaCSV
If cadenaCSV = "***" then Exit Do
If header then
Print "<thead bgcolor=""green"">" & Chr(10) & "<tr><th>";
Else
Print "<tr><td>";
End If
For i As Integer = 1 To Len(cadenaCSV)
txt = Mid(cadenaCSV, i, 1)
Select Case txt
Case ",": If header then Print "</th><th>"; Else Print "</td><td>";
Case "<": Print "&lt;";
Case ">": Print "&gt;";
Case "&": Print "&amp;";
Case Else: Print txt;
End Select
Next i
If header then
Print "</th></tr>" & Chr(10) & "</thead>" & Chr(10) & "<tbody bgcolor=""yellow"">"
Else
Print "</td></tr>"
End If
header = false
Loop Until false
 
Print "</tbody>" & Chr(10) & "</table>"
Print Chr(10) & "</body>"
Print "</html>"
Sleep</lang>
 
 
=={{header|Go}}==
2,130

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.