Method String.trim
Removes any whitespace character from before and after the string
-
Syntax
String String.trim()
Use this function to strip whietespace before and after a string - Return value A new string without leading and trailing whitespace
-
Examples
- To remove whitespace before and after a string
// Define string var s = ' A string with whitespace '; // Output is 'A string with whitespace' s.trim();
- Related String.trimAll String.trimLeft String.trimRight
-
Download
Source
Unless otherwise noted all code in the JSLab Standard Library is licensed as GPLv3. See http://www.gnu.org/licenses/gpl.html for the entire license.
