From da04e3682fcecae4a3d7359e0ef92c1506dbf3f0 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Mon, 30 Jan 2017 18:54:38 -0500 Subject: [PATCH] make trim(String[]) handle arrays, Table.trim() handles columns --- core/src/processing/core/PApplet.java | 3 +++ core/src/processing/data/Table.java | 1 + core/todo.txt | 1 + 3 files changed, 5 insertions(+) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 440bfa838..0ba12d8aa 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -8673,6 +8673,9 @@ public class PApplet implements PConstants { * @param array a String array */ static public String[] trim(String[] array) { + if (array == null) { + return null; + } String[] outgoing = new String[array.length]; for (int i = 0; i < array.length; i++) { if (array[i] != null) { diff --git a/core/src/processing/data/Table.java b/core/src/processing/data/Table.java index be8defeec..4622d6413 100644 --- a/core/src/processing/data/Table.java +++ b/core/src/processing/data/Table.java @@ -4045,6 +4045,7 @@ public class Table { * @see Table#removeTokens(String) */ public void trim() { + columnTitles = PApplet.trim(columnTitles); for (int col = 0; col < getColumnCount(); col++) { trim(col); } diff --git a/core/todo.txt b/core/todo.txt index c1608243e..eee476aaf 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,4 +1,5 @@ 0257 (3.2.5) +X return null for PApplet.trim(null) X StringDict(TableRow) constructor X allow lone double quotes in the midst of csv strings _ make trim() work on column titles as well