Here is an start need to add the search for 55' or actually the ' and get the length. Need some time to do its late here. There is a bit to be added to allow for different string combos and probably needs a strip mtext string to remove the hidden characters in mtext. should wok with plain text a well.
Code:
(defun AH:finddist (x str / )
(setq ans "")
(setq do "yes")
(setq x(+ x 16))
(while (= do "yes")
(setq text (substr str x 1))
(if (= text (chr 39))(setq do "no")
(progn
(setq ans (strcat ans text))
(setq x (+ x 1))
)
)
)
)
(defun ah:addstr ( / obj textans num )
(setq total 0.0)
(while (setq obj (vlax-ename->vla-object (car (entsel "pick MTEXT object"))))
(setq textans (vla-get-textstring obj))
(setq num (vl-string-search "ASPHALT TRENCH" (strcase textans)))
(if (/= num nil)
(progn
(alert (strcat "ASPHALT TRENCH found at " (rtos num 2 0) " position"))
(aH:finddist num textans )
)
(alert "sorry no match")
)
(setq total (+ total (atof ans)))
(alert (strcat "total is " (rtos total 2 2 )))
)
)
(aH:addstr)