TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: CAB on April 24, 2004, 04:38:26 PM

Title: Add Character to string
Post by: CAB on April 24, 2004, 04:38:26 PM
There must be a cleaner way to add a back slash before each quote char in th string.

Code: [Select]
(if (vl-string-search "\"" ln)
 (progn;  Add backslash to hide quotes
   (setq ln (vl-string->list ln)
 newln nil
   )
   (foreach x ln
     (if (= x 34)(setq newln (cons 92 newln)))
     (setq newln (cons x newln))
   ) ; end foreach
   (setq ln (vl-list->string (reverse newln)))
 ) ; end progn
) ; endif
Title: Add Character to string
Post by: Mark on April 24, 2004, 05:10:31 PM
I have to ask CAB, why? What am I missing here! <G>
Title: Add Character to string
Post by: CAB on April 24, 2004, 05:39:27 PM
Well haven't finished testing it but this (http://theswamp.org/phpBB2/viewtopic.php?p=16370#16370) is why.

CAB