<?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 Re: Problem with vl-string-left-trim in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10854924#M50812</link>
    <description>&lt;P&gt;Here you are talking about a different matter, which unfortunately has the same name...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SNVALID and its relatives like TBLOBJNAME etc. handle AutoCAD symbol table objects.&lt;/P&gt;&lt;P&gt;Those are language independent, i.e. you could work with them similarly in VBA, C# or C++, too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I was talking about is Lisp symbols, i.e. those objects without quotation marks the Lisp language uses for referring to functions, variables etc.&amp;nbsp; Here the problem is that when going from raw source code to runtime internal representations, the program is handled via the READ function, which misbehaves with periods.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Common Lisp:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;CLO 3 &amp;gt; (symbol-name (read-from-string "ndd.exe"))
"NDD.EXE"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Visual Lisp:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;_$ (vl-symbol-name (read "ndd.exe"))
"NDD"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The worst part is that Visual Lisp (or AutoLISP, whichever name is preferred) does this without any warning, ignoring the rest of the name after the period, continuing reading the next object after that.&lt;/P&gt;&lt;P&gt;So you are quietly referring to a different symbol than you think when reading the program.&lt;/P&gt;&lt;P&gt;- the program works quite nicely, until you use another name that collides with this, then the results may be odd.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;_$ (setq aa 42)
42
_$ (setq aa.1 'foo)
FOO
_$ (setq aa.78 "something")
"something"
_$ aa
"something"
_$ aa.1
"something"
_$ aa.78
"something"
_$ (vl-symbol-name 'aa.78)
"AA"&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;_$ (defun test () 66)
TEST
_$ (setq test.66 99999)
99999
_$ (test)
; error: bad function: 99999
_1$ &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jan 2022 12:41:30 GMT</pubDate>
    <dc:creator>martti.halminen</dc:creator>
    <dc:date>2022-01-03T12:41:30Z</dc:date>
    <item>
      <title>Problem with vl-string-left-trim</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10846882#M50802</link>
      <description>&lt;P&gt;Having some data of this text form : "Aname = 1236.65" ; we want recover the value 1236.65.&lt;/P&gt;&lt;P&gt;the "Aname" my change ; But we're sure that "=" is still present.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;vl-&lt;SPAN class=""&gt;string&lt;/SPAN&gt;-left-trim&lt;/STRONG&gt; &lt;SPAN class=""&gt;appears to be the perfect solution (according to it's definition):&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN class=""&gt;Removes the specified characters from the beginning of a string&lt;BR /&gt;(vl-string-left-trim character-set string)&lt;BR /&gt;Arguments: character-set: A string listing the characters to be removed&lt;BR /&gt;string : The string to be stripped of character-set.&lt;BR /&gt;Return Values : A string containing a substring of string with all leading characters in character-set removed&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="326.PNG" style="width: 513px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1005554i33F186EDCDFEF80B/image-size/large?v=v2&amp;amp;px=999" role="button" title="326.PNG" alt="326.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Any idea !&lt;/DIV&gt;</description>
      <pubDate>Tue, 28 Dec 2021 17:18:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10846882#M50802</guid>
      <dc:creator>Kh.mbkh</dc:creator>
      <dc:date>2021-12-28T17:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with vl-string-left-trim</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10846933#M50803</link>
      <description>&lt;P&gt;Here my test&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;Command: (setq strcd "Aname = 1236.65")
"Aname = 1236.65"
Command: (setq ndda.exe (vl-string-search "= " strcd 1))
6
Command: (if (= ndda.exe nil) (alert "Missing Equal="))
Command: (atof (substr strcd (+ ndda.exe 2) 255))
1236.65&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 Dec 2021 17:55:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10846933#M50803</guid>
      <dc:creator>diagodose2009</dc:creator>
      <dc:date>2021-12-28T17:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with vl-string-left-trim</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10846939#M50804</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Command: (vl-string-left-trim "Aname = "  "Aname = 1236.65")
"1236.65"&lt;/LI-CODE&gt;
&lt;P&gt;Or simply&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(vl-string-left-trim prefix  str)
(atof (vl-string-left-trim prefix  str))
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Dec 2021 18:01:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10846939#M50804</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2021-12-28T18:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with vl-string-left-trim</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10847078#M50805</link>
      <description>&lt;P&gt;No, the "Aname"&amp;nbsp; change, it my be "rttt = 11" !&lt;/P&gt;</description>
      <pubDate>Tue, 28 Dec 2021 19:24:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10847078#M50805</guid>
      <dc:creator>Kh.mbkh</dc:creator>
      <dc:date>2021-12-28T19:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with vl-string-left-trim</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10847129#M50806</link>
      <description>&lt;P&gt;OK, so &lt;STRONG&gt;Substr&lt;/STRONG&gt; was the perfect solution! Thanks!!&lt;/P&gt;</description>
      <pubDate>Tue, 28 Dec 2021 20:05:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10847129#M50806</guid>
      <dc:creator>Kh.mbkh</dc:creator>
      <dc:date>2021-12-28T20:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with vl-string-left-trim</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10847139#M50807</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8942850"&gt;@Kh.mbkh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;No, the "Aname"&amp;nbsp; change, it my be "rttt = 11" !&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you want to use function vl-string-left-trim to remove unwanted prefix you have to add in search string whole prefix, and not just "=". For that reason this functions is not practical in case like yours where prefix changes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use code provided by &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/565193"&gt;@diagodose2009&lt;/a&gt;&amp;nbsp; or here you have a function that converts string to list&lt;/P&gt;
&lt;LI-CODE lang="general"&gt; (defun string_to_list ( str del / pos )
        (if (setq pos (vl-string-search del str))
            (cons (substr str 1 pos) (string_to_list (substr str (+ pos 1 (strlen del))) del))
            (list str)
        )
    ) &lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;(string_to_list "Aname = 1236.65" " ")
("Aname" "=" "1236.65")&lt;/LI-CODE&gt;
&lt;P&gt;To get number part of a string you use&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Command: (atof (last(string_to_list "Aname = 1236.65" " ")))
1236.65&lt;/LI-CODE&gt;
&lt;P&gt;You can also use "=" as string delimiter since&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Command: (atof (last(string_to_list "Aname = 1236.65" "=")))
1236.65&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Dec 2021 20:13:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10847139#M50807</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2021-12-28T20:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with vl-string-left-trim</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10847778#M50808</link>
      <description>&lt;P&gt;You have a potential bug here (not related to the main matter):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AutoLISP reader stops reading a symbol name at encountering a period, with no warning.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, instead of the variable&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;ndda.exe&lt;/LI-CODE&gt;&lt;P&gt;you actually using NDDA.&amp;nbsp; If that name is used for some other purpose elsewhere in the program, you will overwrite its value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;_$ (read "ndda.exe")
NDDA&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Dec 2021 06:27:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10847778#M50808</guid>
      <dc:creator>martti.halminen</dc:creator>
      <dc:date>2021-12-29T06:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with vl-string-left-trim</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10847793#M50809</link>
      <description>&lt;P&gt;The others have already handled how to do the trimming.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your problem with&amp;nbsp;vl-string-left-trim is that it only removes any of the characters in character-set at the left end of the string, it stops when encountering the first character not in the set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;_$ (vl-string-left-trim  "=" "========PE = 1256")
"PE = 1256"&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 29 Dec 2021 06:40:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10847793#M50809</guid>
      <dc:creator>martti.halminen</dc:creator>
      <dc:date>2021-12-29T06:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with vl-string-left-trim</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10852728#M50810</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5530556"&gt;@hak_vz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's the way.&lt;/P&gt;
&lt;P&gt;Somewhere around here is my old&amp;nbsp;@str2list function that accepts a multicharacter delimiter, should anyone need it.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jan 2022 17:17:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10852728#M50810</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2022-01-01T17:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with vl-string-left-trim</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10852734#M50811</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/569672"&gt;@martti.halminen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's not to say, though, that symbol names can't contain a period.&amp;nbsp; They can (well at least in 2002).&lt;/P&gt;
&lt;P&gt;Command: (snvalid "a.1") T&lt;/P&gt;
&lt;P&gt;Command: (snvalid "ndd.exe") T&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jan 2022 17:23:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10852734#M50811</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2022-01-01T17:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with vl-string-left-trim</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10854924#M50812</link>
      <description>&lt;P&gt;Here you are talking about a different matter, which unfortunately has the same name...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SNVALID and its relatives like TBLOBJNAME etc. handle AutoCAD symbol table objects.&lt;/P&gt;&lt;P&gt;Those are language independent, i.e. you could work with them similarly in VBA, C# or C++, too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I was talking about is Lisp symbols, i.e. those objects without quotation marks the Lisp language uses for referring to functions, variables etc.&amp;nbsp; Here the problem is that when going from raw source code to runtime internal representations, the program is handled via the READ function, which misbehaves with periods.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Common Lisp:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;CLO 3 &amp;gt; (symbol-name (read-from-string "ndd.exe"))
"NDD.EXE"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Visual Lisp:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;_$ (vl-symbol-name (read "ndd.exe"))
"NDD"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The worst part is that Visual Lisp (or AutoLISP, whichever name is preferred) does this without any warning, ignoring the rest of the name after the period, continuing reading the next object after that.&lt;/P&gt;&lt;P&gt;So you are quietly referring to a different symbol than you think when reading the program.&lt;/P&gt;&lt;P&gt;- the program works quite nicely, until you use another name that collides with this, then the results may be odd.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;_$ (setq aa 42)
42
_$ (setq aa.1 'foo)
FOO
_$ (setq aa.78 "something")
"something"
_$ aa
"something"
_$ aa.1
"something"
_$ aa.78
"something"
_$ (vl-symbol-name 'aa.78)
"AA"&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;_$ (defun test () 66)
TEST
_$ (setq test.66 99999)
99999
_$ (test)
; error: bad function: 99999
_1$ &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 12:41:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10854924#M50812</guid>
      <dc:creator>martti.halminen</dc:creator>
      <dc:date>2022-01-03T12:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with vl-string-left-trim</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10855037#M50813</link>
      <description>@Anonymous_halminen&lt;BR /&gt;Ahah!&lt;BR /&gt;Caveat programmor.</description>
      <pubDate>Mon, 03 Jan 2022 13:32:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/problem-with-vl-string-left-trim/m-p/10855037#M50813</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2022-01-03T13:32:24Z</dc:date>
    </item>
  </channel>
</rss>

