Task
Read the contents of a table given a set of coordinates.
Table formatting
Tables will be in this basic format:
|[name]|[name]|
---------------------
[name]| [val]|[val] |
[name]| [val]|[val] |
Column names are always unique within columns. Row names are also unique within rows. This includes names that are the same except whitespace. Values, col names and row names will never have |-
inside them. Names and values will never have spaces inside them, but may have leading or trailing space. Col width is adjustable based on the header/content. Column width is always consistent from top to bottom.
Input
A table and a space separated list of [name]
s.
Example
[table]
row col
If you are writing a function, these can be separate strings, otherwise the row col
will always be the very last line in the input. row col
has some flexibility for the format and may be represented many ways. (e.g. (row, col)
, r, c
, ...). The only hard requirement is that it be one line, and that it must appear in the order col row
.
Output
The contents of a cell specified by the input with no leading or trailing space from the cell.
Examples
In:
|a|z |_*|
------------
atb|1|85|22|
b |5|6 |e$|
/+*|8|we|th|
atb a
Out:
1
In:
| x| b |
----------
ab|l |mmm|
b |le| l |
b b
Out:
l
In:
|a|z |_*| ab |
-------------------
atb|1|85|22| 5 |
b |5|6 |e$| 8 |
/+-|8|we|th| 126 |
atb ab
Out:
5