trim()
Removes whitespaces (including tabs and newlines) from the left and right of the string. If it receives a value other than the string, it trims the value after converting it to a string.
Syntax
trim(STR_EXPR)
Required Parameter
STR_EXPR
- Source string expression. If the expression is
null
, the function returnsnull
.
Usage
json "{}" | eval trimed=trim(" hello world ")
=> "hello world"
json "{}" | eval trimed=trim(123)
=> "123"
json "{}" | eval trimed=trim(null)
=> null