Here is how it works. Just run following script:
However, sometimes Trimming does not work and that happens if we have some unwanted invisible characters at the end of the string. See that example:
In our case we already know what that symbol is, but in the real life we have to research it, and here is how we do this:
Now, when we know, who is a troublemaker we can simply replace unwanted symbol by an empty space, but in our case we can't do that. Symbol with the code 0x09 represents Tabulation and if we simply replace it we can loose all our "TABs" within our text. So, we have to trim that last character of a text if it is unwanted, and only then we can do TRIM operation:
I'm pretty sure you might hit a situation when there will be more then one different trailing unwanted invisible symbols in your string column. Depending on what those symbols are you might prefer to use "REPLACE" function like this:
But as I mentioned earlier, be careful and do not delete a wanted symbol by a mistake.