;; | --------------------------------------------------------------------------- ;; | MI_IdNext ;; | --------------------------------------------------------------------------- ;; | Function : Returns the next alpha-numeric string Id ;; | Argument : 'Id' - Id String to operate on ;; | Returns : The next string 'Id' ;; | Updated : December 6, 2003 ;; | Comments : Works on last character alphabet, ;; | Increments alphabet Id until Z, then replaces it with AA and so on ;; | Integer Id will be incremented straight up. ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | --------------------------------------------------------------------------- (defun MI_IdNext ( Id / len cnt Char Str1 Str2 ) (setq len (strlen Id) cnt 1 Str1 "" Str2 "" ) (repeat len (setq Char (substr Id cnt 1) cnt (1+ cnt) ) (if (member Char (list "0" "1" "2" "3" "4" "5" "6" "7" "8" "9")) (setq Str2 (strcat Str2 Char)) (setq Str1 (strcat Str1 Char)) ) ) (if (/= Str2 "") (setq Str2 (itoa (1+ (atoi Str2)))) (progn (if (/= Str1 "") (setq Str1 (MI_AlphaNext Str1)) ) )) (setq Str2 (strcat Str1 Str2)) )