;; | --------------------------------------------------------------------------- ;; | ST_KeepOnly ;; | --------------------------------------------------------------------------- ;; | Function : Keeps only the specifid characters in a string and strips off ;; | the remaining characters. ;; | Arguments : 'Str' - String to check ;; | 'KeepStr' - String containing characters to keep ;; | Return : The updated string ;; | Updated : June 20, 2004 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | --------------------------------------------------------------------------- (defun ST_KeepOnly (Str KeepStr / ChkLst len1 cnt _Str Char ) (setq ChkLst '() len1 (strlen KeepStr) cnt 1 ) (repeat len1 (setq Char (substr KeepStr cnt 1) cnt (1+ cnt) ) (if (not (member Char ChkLst)) (setq ChkLst (cons Char ChkLst)) ) ) (setq _Str "" len1 (strlen Str) cnt 1 ) (repeat len1 (setq Char (substr Str cnt 1) cnt (1+ cnt) ) (if (member Char ChkLst) (setq _Str (strcat _Str Char)) ) ) _Str )