mirror of
https://github.com/processing/processing4.git
synced 2026-02-04 06:09:17 +01:00
fix replace() with nulls
This commit is contained in:
@@ -3435,9 +3435,18 @@ public class Table {
|
||||
public void replace(String orig, String replacement, int col) {
|
||||
if (columnTypes[col] == STRING) {
|
||||
String[] stringData = (String[]) columns[col];
|
||||
for (int row = 0; row < rowCount; row++) {
|
||||
if (stringData[row].equals(orig)) {
|
||||
stringData[row] = replacement;
|
||||
|
||||
if (orig != null) {
|
||||
for (int row = 0; row < rowCount; row++) {
|
||||
if (orig.equals(stringData[row])) {
|
||||
stringData[row] = replacement;
|
||||
}
|
||||
}
|
||||
} else { // null is a special case (and faster anyway)
|
||||
for (int row = 0; row < rowCount; row++) {
|
||||
if (stringData[row] == null) {
|
||||
stringData[row] = replacement;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user