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.

उदाहरण

सिंटैक्स

trim(str)
trim(strs)

पैरामीटर्स

str
String:

string to trim.

strs
String[]:

strings to trim.

Returns

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

संबंधित संदर्भ