Use loadTable with variable like String, String[], String[][], StringList?

Great, thanks. Processing 3.4 doesn’t display that error message correctly.

Here is a working demo of a String to Table:

/**
 * String to Table
 * 2019-07 Processing 3.4
 * discourse.processing.org/t/use-loadtable-with-variable-like-string-string-string-stringlist/12457/6
 */

import java.io.StringBufferInputStream;

Table table;
String tableStr =
  "A"+"\t"+"B"+"\t"+"C" + "\n" +
  "one"+"\t"+"two"+"\t"+"three" + "\n" + 
  "foo"+"\t"+"bar"+"\t"+"baz";

void setup() {
  try {
    table = new Table(new StringBufferInputStream(tableStr), "tsv");
  }
  catch (IOException err) {
  }
  for (TableRow row : table.rows()) {
    for (int col=0; col<row.getColumnCount(); col++) {
      print(row.getString(col), " ");
    }
    println("");
  }
  exit();
}

output:

A B C
one two three
foo bar baz

2 Likes