Skip to content

Commit ff23364

Browse files
committed
add StringDict constructor, another double quote case
1 parent f393c6b commit ff23364

4 files changed

Lines changed: 26 additions & 0 deletions

File tree

core/src/processing/data/StringDict.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,21 @@ public StringDict(String[][] pairs) {
108108
}
109109

110110

111+
/**
112+
* Create a dictionary that maps between column titles and cell entries
113+
* in a TableRow.
114+
*/
115+
public StringDict(TableRow row) {
116+
String[] titles = row.getColumnTitles();
117+
if (titles == null) {
118+
titles = new StringList(IntList.fromRange(row.getColumnCount())).array();
119+
}
120+
for (int col = 0; col < row.getColumnCount(); col++) {
121+
set(titles[col], row.getString(col));
122+
}
123+
}
124+
125+
111126
/**
112127
* @webref stringdict:method
113128
* @brief Returns the number of key/value pairs

core/src/processing/data/Table.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,12 @@ protected boolean ingest() {
671671
addPiece(start, i, hasEscapedQuotes);
672672
start = i+2;
673673
return true;
674+
675+
} else {
676+
// This is a lone-wolf quote, occasionally seen in exports.
677+
// It's a single quote in the middle of some other text,
678+
// and not escaped properly. Pray for the best!
679+
i++;
674680
}
675681

676682
} else { // not a quoted line

core/todo.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
0257 (3.2.5)
2+
X StringDict(TableRow) constructor
3+
X allow lone double quotes in the midst of csv strings
4+
_ make trim() work on column titles as well
25

36

47
_ no prompt shows with selectInput() on 10.11 and 10.12

todo.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ X Contribution Manager does not show all libraries until filter cleared
66
X https://github.com/processing/processing/issues/4840
77
X fixed in 3.2.4
88

9+
_ NVIDIA driver problems (and means to check)
10+
_ https://github.com/processing/processing/issues/4853
911

1012
_ "Sketch disappeared" infinite pop up dialogs
1113
_ https://github.com/processing/processing/pull/4808

0 commit comments

Comments
 (0)