Author Topic: Add Character to string  (Read 2793 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Add Character to string
« 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
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Add Character to string
« Reply #1 on: April 24, 2004, 05:10:31 PM »
I have to ask CAB, why? What am I missing here! <G>
TheSwamp.org  (serving the CAD community since 2003)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Add Character to string
« Reply #2 on: April 24, 2004, 05:39:27 PM »
Well haven't finished testing it but this is why.

CAB
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.