<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Removing control Characters from a variable in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-control-characters-from-a-variable/m-p/7775646#M108801</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a pdf tool to automate plotting pdf's (setting ctb, page size etc) this also includes naming the pdf where I used someone else's code to return the text string from two attributes to create the a variable "filename" (drawing no and revision tags). this works great so long as the drawing number doesn't have control characters.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The drawingno tags input is RW0000-00/C.C02/0001&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want it to take all the letters and numbers removing control characters so it becomes RW000000C020001&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have managed to find this code&amp;nbsp;(while (vl-string-search "/" filename) (setq filename (vl-string-subst "" "/" filename))) Which has removed the "/" how do I can I add the "-" and "." to this code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2018 22:45:46 GMT</pubDate>
    <dc:creator>Stuboy</dc:creator>
    <dc:date>2018-02-13T22:45:46Z</dc:date>
    <item>
      <title>Removing control Characters from a variable</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-control-characters-from-a-variable/m-p/7775646#M108801</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a pdf tool to automate plotting pdf's (setting ctb, page size etc) this also includes naming the pdf where I used someone else's code to return the text string from two attributes to create the a variable "filename" (drawing no and revision tags). this works great so long as the drawing number doesn't have control characters.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The drawingno tags input is RW0000-00/C.C02/0001&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want it to take all the letters and numbers removing control characters so it becomes RW000000C020001&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have managed to find this code&amp;nbsp;(while (vl-string-search "/" filename) (setq filename (vl-string-subst "" "/" filename))) Which has removed the "/" how do I can I add the "-" and "." to this code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 22:45:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-control-characters-from-a-variable/m-p/7775646#M108801</guid>
      <dc:creator>Stuboy</dc:creator>
      <dc:date>2018-02-13T22:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Removing control Characters from a variable</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-control-characters-from-a-variable/m-p/7775665#M108802</link>
      <description>&lt;P&gt;One example&lt;/P&gt;
&lt;PRE&gt;(setq dat (mapcar 'ascii '("-" "." "/")))
(vl-list-&amp;gt;string (vl-remove-if '(lambda (x) (member x dat)) (vl-string-&amp;gt;list "RW0000-00/C.C02/0001")))&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Feb 2018 22:53:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-control-characters-from-a-variable/m-p/7775665#M108802</guid>
      <dc:creator>Ranjit_Singh</dc:creator>
      <dc:date>2018-02-13T22:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Removing control Characters from a variable</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-control-characters-from-a-variable/m-p/7775693#M108803</link>
      <description>&lt;P&gt;try it , rude as a flintstone work&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(setq filename "RW0000-00/C.C02/0001") 


 


(setq esp#-list ( list "?" "_" "-" "." "," "/"))

(setq filename
(foreach esp# ESP#-LIST 

  (while (vl-string-search esp# filename) (setq filename (vl-string-subst "" esp# filename)))
filename
  
  )
)
                  
 &lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Feb 2018 23:11:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-control-characters-from-a-variable/m-p/7775693#M108803</guid>
      <dc:creator>devitg</dc:creator>
      <dc:date>2018-02-13T23:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Removing control Characters from a variable</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-control-characters-from-a-variable/m-p/7775723#M108804</link>
      <description>&lt;P&gt;perfect devitg thanks legend&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 23:26:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-control-characters-from-a-variable/m-p/7775723#M108804</guid>
      <dc:creator>Stuboy</dc:creator>
      <dc:date>2018-02-13T23:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Removing control Characters from a variable</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-control-characters-from-a-variable/m-p/7775724#M108805</link>
      <description>&lt;P&gt;thanks mate&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 23:26:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-control-characters-from-a-variable/m-p/7775724#M108805</guid>
      <dc:creator>Stuboy</dc:creator>
      <dc:date>2018-02-13T23:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: Removing control Characters from a variable</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-control-characters-from-a-variable/m-p/7775746#M108806</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/549477"&gt;@Stuboy&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
....
&lt;P&gt;The drawingno tags input is RW0000-00/C.C02/0001&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want it to take all the letters and numbers removing control characters so it becomes RW000000C020001&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
....&amp;nbsp;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Here's a way that doesn't remove just those particular three or six characters or any group of characters explicitly spelled out, but takes out &lt;EM&gt;anything&lt;/EM&gt;&amp;nbsp; that's not a letter or number:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(setq&amp;nbsp;newname "")&lt;FONT color="#999999"&gt;; initially empty string&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;(foreach char (vl-string-&amp;gt;list filename)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (if (wcmatch (chr char) "@,#") (setq &lt;SPAN&gt;newname&lt;/SPAN&gt; (strcat &lt;SPAN&gt;newname&lt;/SPAN&gt; (chr char))))&lt;/P&gt;
&lt;P&gt;)&lt;FONT color="#999999"&gt;; foreach&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When applied to your example&amp;nbsp;as the 'filename' variable, it returns&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"RW000000CC020001"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[I assume you meant to have &lt;EM&gt;both&lt;/EM&gt;&amp;nbsp; C's in there, despite one being missing from your sample result string.]&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 23:40:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-control-characters-from-a-variable/m-p/7775746#M108806</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2018-02-13T23:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: Removing control Characters from a variable</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-control-characters-from-a-variable/m-p/7776014#M108807</link>
      <description>&lt;P&gt;Thanks Kent, always a wealth of knowledge, helped me out a lot over the years, this is code I can apply to a few lisps I have&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 04:07:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/removing-control-characters-from-a-variable/m-p/7776014#M108807</guid>
      <dc:creator>Stuboy</dc:creator>
      <dc:date>2018-02-14T04:07:00Z</dc:date>
    </item>
  </channel>
</rss>

