MCPcopy Index your code
hub / github.com/processing/p5.js / trim

Method trim

src/io/p5.Table.js:769–797  ·  view source on GitHub ↗

* Trims leading and trailing whitespace, such as spaces and tabs, * from String table values. If no column is specified, then the * values in all columns and rows are trimmed. A specific column * may be referenced by either its ID or title. * * @deprecated p5.Table will be removed in

(column)

Source from the content-addressed store, hash-verified

767 * // 1 "Snake" "Reptile"
768 */
769 trim (column) {
770 const regex = new RegExp(' ', 'g');
771
772 if (typeof column === 'undefined') {
773 for (let c = 0; c < this.columns.length; c++) {
774 for (let d = 0; d < this.rows.length; d++) {
775 let s = this.rows[d].arr[c];
776 s = s.replace(regex, '');
777 this.rows[d].arr[c] = s;
778 this.rows[d].obj[this.columns[c]] = s;
779 }
780 }
781 } else if (typeof column === 'string') {
782 for (let j = 0; j < this.rows.length; j++) {
783 let val = this.rows[j].obj[column];
784 val = val.replace(regex, '');
785 this.rows[j].obj[column] = val;
786 const pos = this.columns.indexOf(column);
787 this.rows[j].arr[pos] = val;
788 }
789 } else {
790 for (let k = 0; k < this.rows.length; k++) {
791 let str = this.rows[k].arr[column];
792 str = str.replace(regex, '');
793 this.rows[k].arr[column] = str;
794 this.rows[k].obj[this.columns[column]] = str;
795 }
796 }
797 }
798
799 /**
800 * Use <a href="/reference/p5.Table/removeColumn/">removeColumn()</a> to remove an existing column from a Table

Callers 15

generateTypedefInterfaceFunction · 0.80
formatJSDocCommentFunction · 0.80
p5.sound.min.jsFile · 0.80
p5.sound.jsFile · 0.80
passthroughFunction · 0.80
setupFunction · 0.80
styleMethod · 0.80
buildStrandsCallbackFunction · 0.80
handleRetValFunction · 0.80
generateShaderCodeFunction · 0.80
parseMtlFunction · 0.80
parseObjFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected