trim()

Read(2439) Label: remove, string, blank characters,

Description:

Remove the blank characters from both ends of a string.

Syntax:

trim(s)

Note:

The function removes the blank characters on both ends of string s.

Parameter:

s

Source string from which you want to remove the blank characters

Option:

@l

Remove spaces to the left of the string, with the parameter being letter l

@r

Remove spaces to the right of the string; by default, remove spaces on both ends

@a

Remove all extra whitespaces; if there is one or continuous whitespaces within the string, retain only one whitespace; remove the whitespaces between a character and a word, but retain the whitespaces within the quotation marks

Return value:

String

Example:

trim(" abc ")

"abc"

trim(" a bc ")

"a bc"

trim@l(" abc def ")

"abc def "

trim@l("def abc ")

"def abc "

trim@r(" abc def ")

" abc def"

trim@r("def abc ")

"def abc"

trim@a(" a bc ")

"a bc"

trim@a("a  bc")

"a bc"

trim@a("a\'  bc\' ")

"a'  bc'"

trim@a("abc  !")

"abc!"