Hi.
Please assist with argument in function. Im struggling getting this to work.
How to provide (car lst) and (last result) in the function below as an argument, if I run ( get#fromMixedStr "PC-1.01XY") will return value
Thankyou. Been playing this code all night with lots of trial/error thingy. I finally figure it out, it was the list not being localised, therefore the list just keep building up.
101
;;extract number from selected text
;;By Andrea Andreetti
;;12/05/2001
(defun addnum ()
(if (= num nil)
(setq num "")
)
(setq num (strcat num ftxt))
)
;;;--------------------
(defun get#fromMixedStr (lst1 / len1 val ftxt)
;;;(setq mixedstr "PC-1.01XY")
(setq len1 (strlen lst1))
(setq val 1)
(repeat len1
(progn
(setq ftxt (substr lst1 val 1))
(if (= ftxt ".")
(setq ftxt "")
)
(if (numberp (read ftxt))
(addnum)
)
(setq val (+ val 1))
num
)
)
)
The result i would like
(setq lst '("PDU-NT5/2" "PDU-NT5/3" "PDU-NT6/1" "PDU-NT6/2" "PDU-NT6/11"))
===>
(setq lst '("PDU-NT5/2" "PDU-NT5/3" "-" "PDU-NT6/1" "PDU-NT6/2" "-" "PDU-NT6/11"))
therefor i think my problem is the argument in the function
(get#fromMixedStr (car lst))
(get#fromMixedStr (last result))
(defun NumberCheck2 (lst / result diff)
(setq result (list (car lst))
lst (cdr lst)
)
(while (car lst)
(if
(> (- (atoi (get#fromMixedStr (car lst)))
(atoi (get#fromMixedStr (last result))))
1
)
(setq result (append result (list "-" (car lst))))
(setq result (append result (list (car lst))))
)
(setq lst (cdr lst))
)
result
)