;; | --------------------------------------------------------------------------- ;; | ST_ContainsOnly ;; | --------------------------------------------------------------------------- ;; | Function : Checks if a given string contains only any one of the given set ;; | of characters ;; | If Yes, it returns T else nil ;; | Arguments : 'Str' - String to check ;; | 'ContainsStr' - String containing characters to check ;; | Return : T or nil ;; | Updated : February 13, 2004 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | --------------------------------------------------------------------------- (defun ST_ContainsOnly (Str ContainsStr / ChkLst StrLst len1 cnt Char Contains More ) (setq ChkLst '() len1 (strlen ContainsStr) cnt 1 ) (repeat len1 (setq Char (substr ContainsStr cnt 1) cnt (1+ cnt) ) (if (not (member Char ChkLst)) (setq ChkLst (cons Char ChkLst)) ) ) (setq StrLst '() len1 (strlen Str) cnt 1 Contains T More T ) (while More (setq Char (substr Str cnt 1)) (if (not (member Char ChkLst)) (setq Contains nil More nil ) ) (if (= cnt len1) (setq More nil) ) (setq cnt (1+ cnt)) ) Contains )