;; | ---------------------------------------------------------------------------- ;; | ST_CountChar ;; | ---------------------------------------------------------------------------- ;; | Function : Count the number of characters in a string ;; | Argument : 'str' - String to search ;; | 'char' - Character to count ;; | Returns : The number of times the specified character occurs ;; | Comments : The character counted is case sensitive ;; | Updated : February 25, 1999 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ---------------------------------------------------------------------------- (defun ST_CountChar( str char / 1Char len cnt ) (setq len (strlen str) cnt 1 NumChars 0 ) (repeat len (setq 1Char (substr str cnt 1) cnt (1+ cnt) ) (if (= 1Char char) (setq NumChars (1+ NumChars)) ) ) NumChars )