Some Text Methods Not Working

I have a PopupMenu containing some text. I start out with:

Dim theText As String = PopupMenu1.Text

Then I use the “Right” method to get the rightmost character(s) which are numbers. Since the numbers could be >= 10, I use the code:

Dim target As String = theText.Right(2)

This works fine, but since the number might be < 10, I want to trim off the leading white space, so I use the “TrimLeft” method:

target = target.TrimLeft

But when I do, I get the error message: “This method extends type Text, but the base expression is type String.”

The “Right” method seems to work fine with Strings but the “Trim” method seems to require text. I’ve tried numerous things to work around this including “ToText” but nothing has worked. Any thoughts?

It looks like TrimLeft is part of Text but not String
http://developer.xojo.com/text
http://documentation.xojo.com/index.php?title=String&oldid=47175

Use Trim from the classic framework to trim whitespace off Strings.

LTrim is worth a look too:

http://documentation.xojo.com/index.php/LTrim

Both methods work. Thanks very much!