@ec-cad hi,
here something you can start working with 😀
(parse) function will return a list with all the reals numbers each as a string in a sub list
if a string contains 2 numbers, the sub list will have 2 items.
leaving you to finish it as you want.
enjoy
Moshe
(defun parse (lst-str / isNumeric _isdots ;| local functions |;)
(defun _isnumber (c)
(or
(member c '("+" "-" "."))
(and (>= (ascii c) 48) (<= (ascii c) 57))
)
); _isnumber
(setq _isdots (lambda (s) (vl-every (function (lambda (n) (= n 46))) (vl-string->list s))))
; here start parse
(vl-remove-if
'not
(mapcar
'(lambda (str / p ch word dot lst)
(cond
((or
(vl-string-search "TD." str)
(vl-string-search "T." str)
)
nil
); case
( t
(setq p 1 ch (substr str p 1) word "" lst nil)
(while (/= ch "")
(while (_isnumber ch)
(setq word (strcat word ch))
(setq p (1+ p) ch (substr str p 1))
); while
(if (and (/= word "")
(not (_isdots word)) ; ignore ".."
(not (= (atof word) 0.0)) ; ignore 0.00000
(not (= (rem (atof word) 1) 0)) ; not intege number
)
(setq lst (cons word lst))
); if
(setq word "" p (1+ p) ch (substr str p 1))
); while
(reverse lst)
); case
); cond
); lambda
lst-str
); mapcar
); vl-remove-if
); parse