;;----------------------replachr---------------------------- ;; Params: oldchars: ordered list of single characters ;; newchars: ordered list of characters &/or strings ;; instrg: input string ;; Purpose: substitutes the corresponding element of newchars ;; for every occurrence of each oldchar in instrg ;; Return: outstrg: instrg modified as above (defun replachr (oldchars newchars instrg / count flag ndex outstrg) (setq count 1 outstrg "") (repeat (strlen instrg) (setq ndex 0 flag T) (repeat (length oldchars) (if (= (substr instrg count 1) (nth ndex oldchars)) (setq outstrg (strcat outstrg (nth ndex newchars)) flag nil) );if (setq ndex (1+ ndex)) );repeat (if flag (setq outstrg (strcat outstrg (substr instrg count 1)))) (setq count (1+ count)) );repeat outstrg );replachr