Hi Friends, in this article I will explain about how to
Split the string using AutoLISP or how to divide the string with special
character like comma (,), question mark (?), etc.
I explain this with small example.
Suppose you have one string and you have to split the string
with “-“,for this there is no command is there in AutoLISP to split the string
with special character. So I write the code for that.I think it will useful to
you.
(defun c:split_str()
(setq
str1 "aspdotnet-roja")
(setq
len (strlen str1))
(setq
i 1)
(while (<= i len)
(if
(= (substr str1 i 1) "-")
(progn
(setq s (substr str1 (+ i 1) (- (+ len 1) i)))
(setq i len)
)
)
(setq i(+ i 1))
)(alert
s)
)
|
Open AutoCAD and type the below commands.
Command: (load "split")
C:split_str
Command: split_str
|
When we
enter split_str then one alert box
will come with roja as shown in the figure.
Thanks for reading my blog.If really like my blog why are you waiting like my blog from Autolisp-Kishore
No comments:
Post a Comment