Processing, 類Table中的addColumn()用法介紹。
用法
.addColumn().addColumn(title).addColumn(title, type)
參數
title(String)用於新列的標題type(int)用於新列的類型:INT、LONG、FLOAT、DOUBLE 或 STRING
返回
void
說明
使用 addColumn() 將新列添加到 Table 對象。通常,您需要指定一個標題,以便以後可以通過名稱輕鬆引用該列。 (如果未指定標題,則新列的標題將為 null 。)還可以指定列類型,在這種情況下,此列中存儲的所有值必須屬於同一類型(例如,Table.INT 或 Table.FLOAT)。如果未指定類型,則使用默認類型STRING。
例子
Table table;
void setup() {
table = new Table();
table.addColumn("name");
table.addColumn("age", Table.INT);
table.addColumn("height", Table.FLOAT);
TableRow newRow = table.addRow();
newRow.setString("name", "Jermaine");
newRow.setInt("age", 15);
newRow.setFloat("height", 4.567);
saveTable(table, "data/new.csv");
}
// Sketch saves the following to a file called "new.csv":
// name,age,height
// Jermaine,15,4.567
相關用法
- Processing Table.addRow()用法及代碼示例
- Processing Table.matchRow()用法及代碼示例
- Processing Table.findRow()用法及代碼示例
- Processing Table.getInt()用法及代碼示例
- Processing Table.setString()用法及代碼示例
- Processing Table.setFloat()用法及代碼示例
- Processing Table.findRows()用法及代碼示例
- Processing Table.clearRows()用法及代碼示例
- Processing Table.getFloat()用法及代碼示例
- Processing Table.removeColumn()用法及代碼示例
- Processing Table.removeTokens()用法及代碼示例
- Processing Table.getColumnCount()用法及代碼示例
- Processing Table.rows()用法及代碼示例
- Processing Table.getRowCount()用法及代碼示例
- Processing Table.removeRow()用法及代碼示例
- Processing Table.getString()用法及代碼示例
- Processing Table.getRow()用法及代碼示例
- Processing Table.setInt()用法及代碼示例
- Processing Table.getStringColumn()用法及代碼示例
- Processing Table.matchRows()用法及代碼示例
- Processing TableRow.setFloat()用法及代碼示例
- Processing Table用法及代碼示例
- Processing TableRow.setString()用法及代碼示例
- Processing TableRow.getInt()用法及代碼示例
- Processing TableRow.getString()用法及代碼示例
注:本文由純淨天空篩選整理自processing.org大神的英文原創作品 Table.addColumn()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
