Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I currently have this code, but it fails in this circumstance.
(setq L:POS 1)
(setq L:ELSTR "(-10.9)")
(while (< L:POS (strlen L:ELSTR))
(if (numberp (read (substr L:ELSTR L:POS 1)))
(setq L:POS (strlen L:ELSTR))
(setq L:CHR (substr L:ELSTR 1 L:POS))
)
(setq L:POS (1+ L:POS))
)
I have tracked down the error to:
(read (substr L:ELSTR L:POS 1))
; error: malformed list on input
And (substr L:ELSTR L:POS 1) returns:
"("
The end result I need is to extract the negative number from inside the parenthesis. But I also need it to extract the number if the parenthesis are not there. Or extract the number if its positive instead of negative.
Thanks.
Civil 3D 2022,
Windows 10 Pro, x64, Nvidia Quadro P1000
Intel Core i9-11900k; 3.50GHz, 32 GB RAM, 500GB WD BLACK M.2
Windows 10 Pro, x64, Nvidia Quadro P1000
Intel Core i9-11900k; 3.50GHz, 32 GB RAM, 500GB WD BLACK M.2
Solved! Go to Solution.