首页 > 文档 > Table表格对象
2017
07-20

Table表格对象

Name

Table表格对象

Examples

Table table;

 

void setup() {

 

table = new Table();

 

table.addColumn(“id”);

table.addColumn(“species”);

table.addColumn(“name”);

 

TableRow newRow = table.addRow();

newRow.setInt(“id”, table.lastRowIndex());

newRow.setString(“species”, “Panthera leo”);

newRow.setString(“name”, “Lion”);

 

saveTable(table, “data/new.csv”);

}

 

// Sketch saves the following to a file called “new.csv”:

// id,species,name

// 0,Panthera leo,Lion

Description

Table objects store data with multiple rows and columns, much like in a traditional spreadsheet. Tables can be generated from scratch, dynamically, or using data from an existing file. Tables can also be output and saved to disk, as in the example above.

Additional Table methods are documented in the Processing Table Javadoc.

table 对象存储具有多行和多列的数据, 就像在传统的电子表格中一样。可以从头开始、动态地或使用现有文件中的数据生成表。表也可以输出并保存到磁盘, 如上面的示例所示。

 

在处理表 javadoc 中记录了其他表方法。

Methods

addColumn()

Adds a new column to a table

向表中添加新列

removeColumn()

Removes a column from a table

向表中去除新列

getColumnCount()

Gets the number of columns in a table

获取表中的列数

getRowCount()

Gets the number of rows in a table

获取表中的行数

clearRows()

Removes all rows from a table

删除表中的所有行

addRow()

Adds a row to a table

加一行到表中

removeRow()

Removes a row from a table

去除一行

getRow()

Gets a row from a table

从表中获取一行

rows()

Gets multiple rows from a table

从表中获取多个行

getInt()

Get an integer value from the specified row and column从指定的行和列获取整数值

setInt()

Store an integer value in the specified row and column在指定的行和列中存储整数值

getFloat()

Get a float value from the specified row and column从指定的行和列获取浮点值

setFloat()

Store a float value in the specified row and column在指定的行和列中存储浮点值

getString()

Get an String value from the specified row and column从指定的行和列获取字符串值

setString()

Store a String value in the specified row and column在指定的行和列中存储字符串值

getStringColumn()

Gets all values in the specified column

获取指定列中的所有值

findRow()

Finds a row that contains the given value

查找包含给定值的行

findRows()

Finds multiple rows that contain the given value查找包含给定值的多个行

matchRow()

Finds a row that matches the given expression查找与给定表达式匹配的行

matchRows()

Finds multiple rows that match the given expression查找与给定表达式匹配的多个行

removeTokens()

Removes characters from the table

从表中删除字符

trim()

Trims whitespace from values

修剪值中的空白

sort()

Orders a table based on the values in a column根据列中的值对表进行排序

Constructor

Table()

Table(rows)

Related

loadTable()
saveTable()
TableRow



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。