I guess this can help you with what you are looking for
(defun c:test ( )
(pstext (getstring t "\nSpecify Prefix <none>: ") (getstring t "\nSpecify Suffix <none>: ") 1)
)
;; (pstext "Prefix Text" "Suffix Text" <mode>)
;;
;; <mode> = 0 - single selection
;; = 1 - window selection
;;
;; Author: Lee Mac 2011 - www.lee-mac.com
(defun pstext ( preftext sufftext mode / a e i s )
(cond
( (= 0 mode)
(while
(progn (setvar 'ERRNO 0) (setq e (car (nentsel)))
(cond
( (= 7 (getvar 'ERRNO))
(princ "\nMissed, try again.")
)
( (eq 'ENAME (type e))
(if (wcmatch (cdr (assoc 0 (entget e))) "TEXT,MTEXT,ATTRIB,*LEADER,*DIMENSION")
(entmod
(setq e (entget e)
a (assoc 1 e)
e (subst (cons 1 (strcat preftext (cdr a) sufftext)) a e)
)
)
(princ "\nInvalid Object.")
)
)
)
)
)
)
( (setq s (ssget "_:L" (list '(0 . "TEXT,MTEXT,ATTRIB,*LEADER,*DIMENSION"))))
(repeat (setq i (sslength s))
(entmod
(setq e (entget (ssname s (setq i (1- i))))
a (assoc 1 e)
e (subst (cons 1 (strcat preftext (cdr a) sufftext)) a e)
)
)
)
)
)
(princ)
)