Jump to content

Add to string


wimal

Recommended Posts

(setq e  (entget entNotation))
      (setq st (cdr (assoc 1 e)) )
        (entmod (subst (cons 1 (vl-string-subst replace44 find44 st))
                     (assoc 1 e) e))

This code can find some texts and replace some other texts into the string.

But how can I add new texts to the front or end of the string.

Link to comment
Share on other sites

You need to replace vl-string-subst with strcat

 

so to append to the end of the existiring string the code would look like this:

(setq e  (entget entNotation))
      (setq st (cdr (assoc 1 e)) )
        (entmod (subst (cons 1 (strcat (cdr (assoc 1 e)) replace44))
                     (assoc 1 e) e))

 

Edited by mr-blue
  • Thanks 1
Link to comment
Share on other sites

Try this, if you don't want to add any new string just set N as "".

(setq n "123")
(entmod
  (subst (cons 1 (strcat n (vl-string-subst replace44 find44 st)))
	 (assoc 1 e)
	 e
  )
)

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...