bad code, which says better:
Var i As integer
Var MyString, MyShortString As String = " abcdefgh" //4 spaces for example
For i=1 to MyString.Length
if MyString.Mid(i, 1) = Chr(32) then
MyShortString = MyString
MyShortString = MyShortString.right(len(MyShortString) - 1) //delete 1st car.
MyString = MyShortString
Why you not using:
MyShortString = MyShortString.TrimLeft ()
If you only want to trim at the beginning, use trimLeft. If you have whitespace on both sides, use Trim.
BTW - there’s an error in the TrimLeft documentation (issue 69857)
Thank you, I didn’t know about this very useful command!
Since you’re working with a string, the thing to do is look at the documentation for String, look down the list of methods, and see if one might be useful for whatever it is you need to do.