CSV to HTML translation: Difference between revisions
Content added Content deleted
(→{{header|JavaScript}}: Output?) |
No edit summary |
||
Line 230: | Line 230: | ||
<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></pre>(note the output has been modified slightly since this webpage is html.) |
</table></pre>(note the output has been modified slightly since this webpage is html.) |
||
=={{header|AutoIt}}== |
|||
<lang AutoIt> |
|||
$String = "Character,Speech" & @CRLF |
|||
$String &= "The multitude,The messiah! Show us the messiah!" & @CRLF |
|||
$String &= "Brians mother,<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>" & @CRLF |
|||
$String &= "The multitude,Who are you?" & @CRLF |
|||
$String &= "Brians mother,I'm his mother; that's who!" & @CRLF |
|||
$String &= "The multitude,Behold his mother! Behold his mother!" |
|||
$newstring = "<table>" & @CRLF |
|||
$crlfsplit = StringSplit($String, @CRLF, 1) |
|||
For $i = 1 To $crlfsplit[0] |
|||
If $i = 1 Then $newstring &= "<thead>" & @CRLF |
|||
$newstring &= "<tr>" & @CRLF |
|||
$komsplit = StringSplit($crlfsplit[$i], ",") |
|||
For $k = 1 To $komsplit[0] |
|||
If $i = 1 Then |
|||
$newstring &= "<th>" &$komsplit[$k] & "</th>" & @CRLF |
|||
Else |
|||
$newstring &= "<td>" &$komsplit[$k] & "</td>" & @CRLF |
|||
EndIf |
|||
Next |
|||
$newstring &= "</tr>" & @CRLF |
|||
If $i = 1 Then $newstring &= "</thead>" & @CRLF |
|||
Next |
|||
$newstring &= "</table>" |
|||
</lang> |
|||
Output: |
|||
<pre><table> |
|||
<thead> |
|||
<tr> |
|||
<th>Character</th> |
|||
<th>Speech</th> |
|||
</tr> |
|||
</thead> |
|||
<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></pre> |
|||
=={{header|AWK}}== |
=={{header|AWK}}== |