Finding the end of a add_text string

Hi, I want to find the end of a TEXT string I added. E.g.,
$text = @entities.add_text(“TEXT”,[X,Y,0] #
If you can do it in 3 dimensions thats great. If 2 that also works.
Thnx in advance, Sannerwind@gmail.com