This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.
Name | trim() |
||||
---|---|---|---|---|---|
Examples | String s1 = " Somerville MA "; println(s1); // Prints " Somerville MA " String s2 = trim(s1); println(s2); // Prints "Somerville MA" String[] a1 = { " inconsistent ", " spacing" }; // Note spaces String[] a2 = trim(a1); printArray(a2); // Prints the following array contents to the console: // [0] "inconsistent" // [1] "spacing" | ||||
Description | Removes whitespace characters from the beginning and end of a String. In addition to standard whitespace characters such as space, carriage return, and tab, this function also removes the Unicode "nbsp" character. | ||||
Syntax | trim(str) trim(array) | ||||
Parameters |
| ||||
Returns | String or String[] | ||||
Related | split() join() |
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.