CSV to HTML translation: Difference between revisions
Content deleted Content added
m →{{header|JavaScript}}: Template had wrong language name. |
|||
Line 2,648: | Line 2,648: | ||
<tr><td>The multitude</td><td>Behold his mother! Behold his mother!</td></tr> |
<tr><td>The multitude</td><td>Behold his mother! Behold his mother!</td></tr> |
||
</table></lang> |
</table></lang> |
||
=={{header|Run BASIC}}== |
|||
The extra credit version has 2 extra lines of code to get the heading. |
|||
<lang rnbasic>csv$ = "Character,Speech |
|||
The multitude,The messiah! Show us the messiah! |
|||
Brians mother,<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry> |
|||
The multitude,Who are you? |
|||
Brians mother,I'm his mother; that's who! |
|||
The multitude,Behold his mother! Behold his mother!" |
|||
k = instr(csv$,",") ' 2 exra lines to get heading |
|||
csv$ = left$(csv$,k - 1) + "</th><th> + mid$(csv$,k + 1) |
|||
csv$ = strRep$(csv$,",","</td><td>") |
|||
html "<table border=1><TR bgcolor=wheat align=center><th>";strRep$(csv$,chr$(13),"</td></tr><tr><td>");"</td></tr></table" |
|||
wait |
|||
' -------------------------------- |
|||
' string replace rep str with |
|||
' -------------------------------- |
|||
FUNCTION strRep$(strRep$,rep$,with$) |
|||
ln = len(rep$) |
|||
k = instr(strRep$,rep$) |
|||
while k |
|||
strRep$ = left$(strRep$,k - 1) + with$ + mid$(strRep$,k + ln) |
|||
k = instr(strRep$,rep$) |
|||
WEND |
|||
END FUNCTION</lang> |
|||
----- Output ------ |
|||
<table border=1><TR bgcolor=wheat align=center><th>Character</th><th>Speech</th></TR> |
|||
<TR><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr> |
|||
<tr><td>Brians mother</td><td><angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry></td></tr> |
|||
<tr><td>The multitude</td><td>Who are you?</td></tr> |
|||
<tr><td>Brians mother</td><td>I'm his mother; that's who!</td></tr> |
|||
<tr><td>The multitude</td><td>Behold his mother! Behold his mother!</td></tr></table> |
|||
=={{header|Seed7}}== |
=={{header|Seed7}}== |