p5.Table removeTokens() Method Last Updated : 15 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The removeTokens() method of p5.Table in p5.js is used to remove all the specified characters from values in the table. A specific column can be specified for removing the token from only that column. However, if no column is specified then the values of all the columns and rows in the table are processed. Syntax: removeTokens( chars, [column] ) Parameters: This function accepts two parameters as mentioned above and described below: chars: It is a String that specifies all the characters that have to be removed. column: It is a String or integer that specifies the column name or ID of the column to be trimmed. It is an optional parameter. The example below illustrates the removeTokens() method in p5.js. Example 1: javascript function setup() { createCanvas(500, 300); textSize(16); tokensInput = createInput(); tokensInput.position(30, 40) trimBtn = createButton("Remove specified tokens"); trimBtn.position(30, 80); trimBtn.mouseClicked(cleanTableData); // Create the table table = new p5.Table(); // Add two columns table.addColumn("subject"); table.addColumn("performance"); // Add some rows to the table let newRow = table.addRow(); newRow.setString("subject", "----Maths---"); newRow.setString("performance", "====Good==="); newRow = table.addRow(); newRow.setString("subject", " English"); newRow.setString("performance", "__-Excellent--"); newRow = table.addRow(); newRow.setString("subject", "Science"); newRow.setString("performance", ",,, ;;OK;"); showTable(); } function cleanTableData() { let tokensToRemove = tokensInput.value(); // Remove given tokens only from the // whole table table.removeTokens(tokensToRemove); // Redraw the table showTable(); } function showTable() { clear(); // Display the rows present in the table for (let r = 0; r < table.getRowCount(); r++) for (let c = 0; c < table.getColumnCount(); c++) text(table.getString(r, c), 20 + c * 100, 140 + r * 20); text("Enter the tokens that have to be" + " removed from the table values", 20, 20); } Output: Example 2: javascript function setup() { createCanvas(500, 300); textSize(16); tokensInput = createInput(); tokensInput.position(30, 40) trimBtn = createButton("Remove specified tokens"); trimBtn.position(30, 80); trimBtn.mouseClicked(cleanTableData); // Create the table table = new p5.Table(); // Add two columns table.addColumn("subject"); table.addColumn("performance"); // Add some rows to the table let newRow = table.addRow(); newRow.setString("subject", "----Maths---"); newRow.setString("performance", "-----Good==="); newRow = table.addRow(); newRow.setString("subject", "-----English---"); newRow.setString("performance", "__-Excellent--"); newRow = table.addRow(); newRow.setString("subject", "-Science---"); newRow.setString("performance", ",,, ;OK;"); showTable(); } function cleanTableData() { let tokensToRemove = tokensInput.value(); // Remove given tokens only from the // 'name' column table.removeTokens(tokensToRemove, 'subject'); // Redraw the table showTable(); } function showTable() { clear(); // Display the rows present in the table for (let r = 0; r < table.getRowCount(); r++) for (let c = 0; c < table.getColumnCount(); c++) text(table.getString(r, c), 20 + c * 100, 140 + r * 20); text("Enter the tokens that have to be" + " removed from the table values", 20, 20); } Output: Online editor: https://editor.p5js.org/ Environment Setup: https://www.geeksforgeeks.org/javascript/p5-js-soundfile-object-installation-and-methods/ Reference: https://p5js.org/reference/#/p5.Table/removeTokens Comment More infoAdvertise with us Next Article p5.Table setNum() Method S sayantanm19 Follow Improve Article Tags : JavaScript Web Technologies JavaScript-p5.js Similar Reads p5.js Table removeColumn() Method The removeColumn() method of p5.Table in p5.js is used to remove the given column from a table. The column to remove can be specified by either using its title or its index value (column ID). Syntax: removeColumn( column ) Parameters: This function accepts a single parameter as mentioned above and d 3 min read p5.js p5.Table removeRow() Method The removeRow() method of p5.Table in p5.js is used to remove the given row from a table. The row to delete is specified using its row ID. Syntax: removeRow( id ) Parameters: This function accepts a single parameter as mentioned above and described below: id: It is a Number that denotes the ID of th 3 min read p5.Table setNum() Method The setNum() method of p5.Table in p5.js is used to store the given Float value to the given row and column of the table. The row can be specified by the row ID and the column can be specified by its column ID or column name. Syntax:setNum( row, column, value )Parameters: This function accepts three 2 min read p5.Table setString() Method The setString() method of p5.Table in p5.js is used to store the given String value to the given row and column of the table. The row can be specified by the row ID and the column can be specified by its column ID or column name. Syntax: setString( row, column, value ) Parameters: This function acce 3 min read p5.TableRow setString() Method The setString() method of p5.TableRow in p5.js is used to store the given String value to the given column of the table row. The column can be specified by its column ID or column name. Syntax: setString( column, value ) Parameters: This method accepts two parameters as mentioned above and described 3 min read HTML DOM TokenList.remove() Method The TokenList.remove() Method in HTML DOM is used to remove the particular nodes or tokens from a NodeList. It is an in-built method of TokenList Object. Syntax: remove(token); remove(token, token); remove(token, token, token); ... Parameter Values: It contains a string value that represents the nam 1 min read Like