;; | ---------------------------------------------------------------------------- ;; | ST_FindPattern ;; | ---------------------------------------------------------------------------- ;; | Function : Returns the start of a given text pattern in a test string ;; | Argument : 'Str' - Text String to check ;; | 'Pat' - Pattern string to search ;; | Return : The starting position of the first pattern string, if pattern is ;; | found else returns nil. ;; | Update : June 24, 2008 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ---------------------------------------------------------------------------- (defun ST_FindPattern( Str Pat / len1 len2 pos Found _Str ) (setq len1 (strlen Str) len2 (strlen Pat) pos nil ) (if (>= len1 len2) (progn (setq Found nil pos 1 ) (while (not Found) (setq _Str (substr Str pos len2)) (if (equal _Str Pat) (setq Found T) (setq pos (1+ pos)) ) (if (> pos len1) (setq Found T pos nil ) ) ) )) pos )