back to Overview

_.trim()

Removes whitespace from the beginning and end of the given string and returns the result.
Util module only.

Syntax

_.trim(s)

Parameters

s
the string to trim. If not a string, it will be converted using _.toString().
(return value)
the trimmed string

Description

Removes whitespace from the beginning and end of the given string and returns the result.

Example

Removing whitespace

_.trim('abc'); // no change: returns 'abc'
_.trim('  abc '); // returns 'abc'
_.trim(' a b c '); // returns 'a b c' (only whitespace at beginning and end is removed)

Comments

comments powered by Disqus

back to Overview

Functions