◐ Shell
clean mode source ↗

Add separator argument to loadTable() (#5068) by christianbender · Pull Request #5564 · processing/processing

I fixed the issue #5068 (enhancement). Now we can choice a separator for the CSV-files. And open this as well.

Table table;

void setup() {

  table = loadTable("mammal2.csv", "header", ';');

  println(table.getRowCount() + " total rows in table"); 

  for (TableRow row : table.rows()) {

    int id = row.getInt("id");
    String species = row.getString("species");
    String name = row.getString("name");

    println(name + " (" + species + ") has an ID of " + id);
  }
}
  • The file mammal2.csv is now seperated with ;

Another example

Table table;

void setup() {

  table = loadTable("mammal2.csv",';');

  println(table.getRowCount() + " total rows in table"); 

  for (TableRow row : table.rows()) {

    println(row.getString(1));
  }
}