diff --git a/core/src/processing/data/Table.java b/core/src/processing/data/Table.java index 61817d516..657fd6e5d 100644 --- a/core/src/processing/data/Table.java +++ b/core/src/processing/data/Table.java @@ -4067,6 +4067,11 @@ public class Table { } setColumnCount(lastColumn + 1); + // trim() works from both sides + while (getColumnCount() > 0 && isEmptyArray(getStringColumn(0))) { + removeColumn(0); + } + // remove empty rows (starting from the end) int lastRow = lastRowIndex(); //while (isEmptyRow(lastRow) && lastRow >= 0) { @@ -4074,6 +4079,10 @@ public class Table { lastRow--; } setRowCount(lastRow + 1); + + while (getRowCount() > 0 && isEmptyArray(getStringRow(0))) { + removeRow(0); + } } diff --git a/core/todo.txt b/core/todo.txt index fb384dbc2..e0f598d8b 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -6,6 +6,8 @@ X make trim() work on column titles as well o add trimRows() and trimColumns() o would you ever use one w/o the other? X just make this part of trim() +X also remove rows/columns from beginning +X since that's what trim() on strings does X consume Unicode BOM (0xFEFF) in createReader() and Table parser o no prompt shows with selectInput() on 10.11 and 10.12 X https://github.com/processing/processing/issues/4758