Great question! There are a number of ways to trim leading and trailing characters in a string using built-in functions.
Do you know what you need to trim, or do you have to detect it?
Is it possible that the trim string is also contained in the middle of the string?
The simplest option is the replace function. The following map function:
=map(replace(tablename::columnname, "aaa","") will replace all instances of "aaa" with the null string ("").
If there is risk to the body of the string, you can specifically trim from the front and back, using a combination of ifStr, find and rfind to identify if the leading or trailing characters need to be stripped away, and then use substring to strip them out, after identifying them.
Does that help? If not, tell me more!