Trim removes leading and trailing whitespace from a String. I’m not clear on what you’re doing but I imagine you’re looking for Replace. See: Replace — Xojo documentation Note that Replace removes the first occurrence of a character so you may also need to use it conjunction with Right String — Xojo documentation
String.Trim page has an extra row on the Table, it should only show ‘result’ and ‘stringVariable’. You can’t use sourceString because sourceString is something like " this is the source " when a sourceVariable you need to do:
Var myString As String = " this is the string variable "
myString = myString.Trim // the result is "this is the string variable"
Note: I was on the phone when I started typing here. I disagree with Gavin’s edit. SourceString.Trim I expect something like this to work:
Naming a variable ‘source’ doesn’t make it sourceString but stringVariable.
I think these edits are different that information posted on other docs, making that confusing to the user learning Xojo.
result = Trim(sourceString) is clear that it refers to Trim(" this is a test ")
result = stringVariable.Trim is clear that it refers to a Var named stringVariable
If you changed the table and example for String.Trim, then you will need to change Trim, String.TrimLeft and String.TrimRight to match the information and be consistent.
I am happy with the edits, since they are no longer confusing.
I apologize for not posting this in testers. I turned deprecation on and this popped up.
Since I had just analyzed it and it didn’t show, etc, etc.
I am not happy with the edits, they are different than what Xojo used for Trim, String.TrimLeft and String.TrimRight that will cause confusion to users.
For me ‘source’ is not a ‘variable’ even if we name that source and you can review the docs and in many places you can see that ‘source’ is reference to actual source and not the variable that holds that source.