Hello
Can I change a the Lisp so it works well with less.
Will not tolerate it.
Thank you
100.1/10
100.1/9
100.1/09
Hallo
Kann mir einer das Lisp so ändern das es auch mit minus funktioniert.
Bekomme das nicht hin.
Danke
;; INCSUFF -Gilles Chanteau- 2008/01/15
;; Adds the specified increment to a string suffix.
;; Is considered as suffix, all [0-9], [A-Z] and [a-z] characters from
;; the end of the string according to flag value.
;;
;; Arguments
;; str : a string
;; inc : a positive integer
;; flag : an integer, the sum of following binary codes
;; 1 for numbers [0-9]
;; 2 for uppercase [A-Z]
;; 4 for lowercase [a-z]
;;
;; Return
;; The string with incremented suffix (or nil if none valid suffix)
;;
;; Examples :
;; (incsuff "N° 002" 12 1) = "N° 014"
;; (incsuff "Drawing_A" 1 1) = "Drawing_B"
;; (incsuff "test_ZZ9" 1 3) = "test_AAA0"
;; (incsuff "test_ZZ9" 1 1) = "test_ZZ10"
;; (incsuff "12-" 1 nil) = nil
;;
;; Update (13/02/08) : binary codes
(defun incsuff (str inc flag / lst crt pas ind dep quo ret)
(setq lst (reverse (vl-string->list str)))
(while
(and
(setq crt (car lst))
(cond
((< 47 crt 58)
(setq pas 10
ind 48
)
)
((and flag (< 64 crt 91))
(setq pas 26
ind 65
)
)
((and flag (< 96 crt 123))
(setq pas 26
ind 97
)
)
((< 0 quo)
(setq crt (if (= 10 pas)
ind
(1- ind)
)
lst (cons (car lst) lst)
)
)
)
)
(setq dep (- crt ind)
quo (/ (+ dep inc) pas)
ret (cons (+ ind (rem (+ dep inc) pas)) ret)
)
(if (zerop quo)
(setq ret (append (reverse (cdr lst)) ret)
lst nil
)
(if (cdr lst)
(setq lst (cdr lst)
inc quo
)
(setq lst (list ind)
inc (if (= 10 pas)
quo
(1- quo)
)
)
)
)
)
(if ret
(vl-list->string ret)
)
)