Is there a built-in function to trim leading and trailing whitespace such that trim(\" hello world \") eq \"hello world\"?
trim(\" hello world \") eq \"hello world\"
No, but you can use the s/// substitution operator and the \s whitespace assertion to get the same result.
s///
\s