Referencia trim()

trim()

Removes whitespace from the start and end of a String without changing the middle.

trim() trims whitespace characters such as spaces, carriage returns, tabs, Unicode "nbsp" character.

The parameter, str, is the string to trim. If a single string is passed, as in trim(' pad '), a single string is returned. If an array of strings is passed, as in trim([' pad ', '\n space \n']), an array of strings is returned.

Ejemplos

Sintaxis

trim(str)
trim(strs)

Parámetros

str
String:

string to trim.

strs
String[]:

strings to trim.

Notice any errors or typos? Please let us know. Please feel free to edit src/utilities/string_functions.js and open a pull request!

Referencias Relacionadas