BIGAL Posted 1 hour ago Posted 1 hour ago (edited) I am going around in circle and not sure why. I have a Mtext a simple 3 line Mtext (setq txt "Abcdef\\Pghijk\\Plmnop") desired text for Excel a multi line cell "Abcdef\nghijk\nlmnop" thought something like this should work. Tried all sorts of combinations. Note a dbl \\ will leave the P behind but get multi lines. (setq txt (vl-string-translate "\\P" "\n" txt)) I have all the other code done putting all the object values int Excel cells. Think Dataextract. Edited 1 hour ago by BIGAL Quote
rlx Posted 8 minutes ago Posted 8 minutes ago (defun c:t1 ( / txt1 delimiter txt2 ) (setq txt1 "Abcdef\\Pghijk\\Plmnop") (setq delimiter "\\P") (setq txt2 (pjk-Strparse txt1 delimiter)) (princ (strcat "\ntxt2 = " (vl-prin1-to-string txt2))) (princ) ) ;;; https://www.cadtutor.net/forum/topic/95913-replace-p-in-a-variable/ ;|============================================================================== Function Name: (pjk-StrParse) Arguments: str = String; String to process del = String; Delimiter to separate the string Usage: (pjk-StrParse <string> <delimter>) Returns: List; A list of strings Description: Separates a string into a list of strings using a specified delimiter string; uses recursion. ================================================================================|; (defun pjk-StrParse (str del / pos) (if (and str del) (if (setq pos (vl-string-search del str)) (cons (substr str 1 pos) (pjk-StrParse (substr str (+ pos 1 (strlen del))) del)) (list str) ) ) ) ;; End Function (pjk-StrParse) Quote
Recommended Posts
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.