In Xojo 2021r2, the ability to specify whitespace for the trim functions was introduced and went largely unpromoted apart from the release notes. Using Trim (or LTrim or RTrim) will remove whitespaces from the beginning, end or both of your string. Plus the new function allows you to specify what you want to trim.
For example, when accessing one of my API services I get a date value in the form of “\/Date(1487615045743+0000)\/”. I’m only interested in the data between the brackets which represents a number of seconds from the Unix Epoch and a Time zone offset so I need to strip off the “\/Date(“ and the “)\/”. I can now do this with a single line of code!
value = value.Trim("\/Date(", ")\/")
And value now is “1487615045743+0000”, which is much easier to deal with.
Another example would be:
Value = DecodeURLComponent(QueryString.Trim("Name="))
You could use this in a web application HandleURL Event to strip the key name from the value.
I see so many ways this little gem will make my life easier!