The htmltablerow( function extracts the data from a row in an HTML table.
Parameters
This function has three parameters:table – text of the HTML table. If this parameter contains the body of an HTML table, the table must contain <tr>
and <td>
tags (however, the actual <table>
and </table>
tags themselves are not required).
row – row number within HTML table. Rows are numbered starting from 1.
separator – the separator character for the output array.
Description
This function extracts the data from a row in an HTML table. Suppose you set up a variable with an HTML table, like this:
local htable
htable =
"<tr><td><font size=-1>Alaska</font></td><td>AK</td></tr>
<tr><td><font size=-1>Arizona</font></td><td>AR</td></tr>
<tr><td><font size=-1>Wyoming</font></td><td>WY</td></tr>"
Once this variable is set up, you can extract different table elements using the htmltablerow( function.
htmltablerow(htable,1,",") ☞ Alaska,AK
htmltablerow(htable,3,",") ☞ Wyoming,WY
This function removes any HTML tags in the row (in the example above, removing the font
tags). If you want to keep the tags, use the htmltablerowraw( function.
htmltablerowraw(htable,1) ☞ <td><font size=-1>Alaska</font></td><td>AK</td>
htmltablerowraw(htable,3) ☞ <td><font size=-1>Wyoming</font></td><td>WY</td>
Note: This function is equivalent to:
tagstrip(tagarray(arrayrange(tagdata(thetable,"<tr","</tr>",therow),2,9999,">"),"<td>","</td>",thesep),"<",">")
See Also
History
Version | Status | Notes |
10.0 | New | New in this version. |