What you did seems fine to me.
Then again I have no idea what you mean by removing text.
You can't subtract from a string unless you do something like use the replace() expression, and replace the text with ""
I don't really suggest using text to do comparisons, but whatever floats your boat.
Likewise I really don't suggest using object id's.
Assigned variables, or its index is a better way to go.