add StringDict constructor, another double quote case

This commit is contained in:
Ben Fry
2017-01-30 18:50:16 -05:00
parent 0353d175eb
commit 6f2297681c
4 changed files with 26 additions and 0 deletions

View File

@@ -108,6 +108,21 @@ public class StringDict {
}
/**
* Create a dictionary that maps between column titles and cell entries
* in a TableRow.
*/
public StringDict(TableRow row) {
String[] titles = row.getColumnTitles();
if (titles == null) {
titles = new StringList(IntList.fromRange(row.getColumnCount())).array();
}
for (int col = 0; col < row.getColumnCount(); col++) {
set(titles[col], row.getString(col));
}
}
/**
* @webref stringdict:method
* @brief Returns the number of key/value pairs