Removes the specified substring from the beginning and the end of a string.
Syntax
trim(string,substr)
Usage
This function removes substr from the beginning and end of string, then returns the result. To remove leading and trailing spaces, do not specify a value for substr.
Example
–- the resulting string in both cases is 'MyString';
q = foreach q generate trim("abcMyStringabc","abc") as 'Trimmed String';
q = foreach q generate trim(" MyString ") as 'Trimmed String';