<?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: LSP:  Replace Last Character with User Specified Character in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12140105#M92132</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14234903"&gt;@rozywahana&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Full code &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12138779#M452486" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Aug 2023 02:27:15 GMT</pubDate>
    <dc:creator>ronjonp</dc:creator>
    <dc:date>2023-08-01T02:27:15Z</dc:date>
    <item>
      <title>LSP:  Replace Last Character with User Specified Character</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8625623#M92121</link>
      <description>&lt;P&gt;Lisp needed to replace the last character in selected text objects, with a user specified text value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 18:45:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8625623#M92121</guid>
      <dc:creator>jlaidle1</dc:creator>
      <dc:date>2019-02-27T18:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: LSP:  Replace Last Character with User Specified Character</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8625661#M92122</link>
      <description>&lt;P&gt;If it's just one character at the end this should do:&lt;/P&gt;
&lt;PRE&gt;(setq str "MyText")
(setq newstr "Foo")
(strcat (substr str 1 (1- (strlen str))) newstr)

&lt;/PRE&gt;
&lt;P&gt;And the whole enchilada &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;(defun c:foo (/ a b s)
  (if
    (and (/= "" (setq a (getstring "\nEnter new string: "))) (setq s (ssget ":L" '((0 . "text")))))
     (foreach x	(vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
       (setq b (cdr (assoc 1 (entget x))))
       (entmod (append (entget x) (list (cons 1 (strcat (substr b 1 (1- (strlen b))) a)))))
     )
  )
  (princ)
)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 19:06:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8625661#M92122</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2019-02-27T19:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: LSP:  Replace Last Character with User Specified Character</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8625683#M92123</link>
      <description>&lt;PRE&gt;(defun c:TextLastRep ( / s c i e x)

  (if (and (setq s (ssget "_:L" '((0 . "TEXT"))))
	   (setq c (getstring T "\nNew last char: "))
	   )
    (repeat (setq i (sslength s))
      (and (setq e (ssname s (setq i (1- i))))
	   (setq x (getpropertyvalue e "TextString"))
	   (setq x (substr x 1 (1- (strlen x))))
	   (setpropertyvalue e "TextString" (strcat x c)))))
  (princ)
  )&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Feb 2019 19:06:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8625683#M92123</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2019-02-27T19:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: LSP:  Replace Last Character with User Specified Character</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8625771#M92124</link>
      <description>&lt;P&gt;Works great!!!!!!&amp;nbsp; Can this also work for MTEXT objects?&lt;/P&gt;
&lt;P&gt;Our users sometimes, for some reason, use MTEXT for single line text objects.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 19:38:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8625771#M92124</guid>
      <dc:creator>jlaidle1</dc:creator>
      <dc:date>2019-02-27T19:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: LSP:  Replace Last Character with User Specified Character</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8625809#M92125</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5054769"&gt;@jlaidle1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Works great!!!!!!&amp;nbsp; Can this also work for MTEXT objects?&lt;/P&gt;
&lt;P&gt;Our users sometimes, for some reason, use MTEXT for single line text objects.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8625661#M381681" target="_blank" rel="noopener"&gt;THIS&lt;/A&gt; should do what you want as well .. not MTEXT though.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 19:49:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8625809#M92125</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2019-02-27T19:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: LSP:  Replace Last Character with User Specified Character</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8625822#M92126</link>
      <description>&lt;P&gt;Here's one that will do mtext too .. although the last character in an mtext string could be part of formatting so results could get a bit wonky.&lt;/P&gt;
&lt;PRE&gt;(defun c:foo (/ a b o s)
  (and (/= "" (setq a (getstring "\nEnter new string: ")))
       (setq s (ssget ":L" '((0 . "*text"))))
       (foreach	x (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
	 (setq b (vla-get-textstring (setq o (vlax-ename-&amp;gt;vla-object x))))
	 (vla-put-textstring o (strcat (substr b 1 (1- (strlen b))) a))
       )
  )
  (princ)
)
(vl-load-com)&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Feb 2019 19:55:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8625822#M92126</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2019-02-27T19:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: LSP:  Replace Last Character with User Specified Character</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8625868#M92127</link>
      <description>&lt;P&gt;This will skip the formatted MTexts with info warning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:TextLastRep ( / s c i p e x)

  (if (and (setq s (ssget "_:L" '((0 . "*TEXT"))))
	   (setq c (getstring T "\nNew last char: "))
	   )
    (repeat (setq i (sslength s))
      (and (setq e (ssname s (setq i (1- i))))
	   (setq p (if (= "MText" (getpropertyvalue e "LocalizedName"))
		     (cond ((= (getpropertyvalue e "Text")
			       (getpropertyvalue e "Contents"))
			    "Contents")
			   ((prompt (strcat "\n'" (getpropertyvalue e "Text") "' skipped due format chars: " (getpropertyvalue e "Contents")))))
		     "TextString"))
	   (setq x (getpropertyvalue e p))
	   (setq x (substr x 1 (1- (strlen x))))
	   (setpropertyvalue e p (strcat x c)))))
  (princ)
  )&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Feb 2019 20:12:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8625868#M92127</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2019-02-27T20:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: LSP:  Replace Last Character with User Specified Character</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8627679#M92128</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5054769"&gt;@jlaidle1&lt;/a&gt;&amp;nbsp; Not sure what to make of this thread. I've helped hundreds of people over the years and this is the first time I've been publicly ghosted. ( is that a thing now? )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyhoo ... if you're ever using an older version of CAD that does not include the get/setpropertyvalue functions included in&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&amp;nbsp;'s code .. feel free to use mine as it should work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-02-28_7-13-57.gif" style="width: 334px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/608496i4B579344D180E308/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-02-28_7-13-57.gif" alt="2019-02-28_7-13-57.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 14:14:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/8627679#M92128</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2019-02-28T14:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: LSP:  Replace Last Character with User Specified Character</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12138710#M92129</link>
      <description>&lt;P&gt;mr &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/593837"&gt;@ronjonp&lt;/a&gt;&amp;nbsp;could u help me making lsp for string-replace&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;;; Example usage&lt;BR /&gt;(setq str "abcdeeeabcdeeeabcdeee")&lt;BR /&gt;(setq trimmed-str (string-replace str "e" ""))&lt;BR /&gt;;; trimmed-str will be "abcdabcdabcd"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2023 14:46:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12138710#M92129</guid>
      <dc:creator>rozywahana</dc:creator>
      <dc:date>2023-07-31T14:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: LSP:  Replace Last Character with User Specified Character</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12138779#M92130</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14234903"&gt;@rozywahana&lt;/a&gt;&amp;nbsp;Try this:&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun _removechar (ch str) (vl-list-&amp;gt;string (vl-remove (ascii ch) (vl-string-&amp;gt;list str))))
(setq str "abcdeeeabcdeeeabcdeee")
(_removechar "e" str)
;; "abcdabcdabcd" &lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 31 Jul 2023 15:08:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12138779#M92130</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2023-07-31T15:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: LSP:  Replace Last Character with User Specified Character</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12140069#M92131</link>
      <description>mr &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/593837"&gt;@ronjonp&lt;/a&gt; can you write it in full code&lt;BR /&gt;Thank you in advance</description>
      <pubDate>Tue, 01 Aug 2023 01:58:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12140069#M92131</guid>
      <dc:creator>rozywahana</dc:creator>
      <dc:date>2023-08-01T01:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: LSP:  Replace Last Character with User Specified Character</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12140105#M92132</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14234903"&gt;@rozywahana&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Full code &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12138779#M452486" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;HERE&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 02:27:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12140105#M92132</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2023-08-01T02:27:15Z</dc:date>
    </item>
    <item>
      <title>Remove few string at front text</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12140141#M92133</link>
      <description>&lt;P&gt;thanks before&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/593837"&gt;@ronjonp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;actually i mean lisp that can remove few character at front text like this,&lt;/P&gt;&lt;P&gt;before:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="A.jpg" style="width: 299px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1247532i9CCD55A11CB041A9/image-dimensions/299x146?v=v2" width="299" height="146" role="button" title="A.jpg" alt="A.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="B.jpg" style="width: 242px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1247533iA89CC029A31FF26D/image-dimensions/242x145?v=v2" width="242" height="145" role="button" title="B.jpg" alt="B.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 03:00:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12140141#M92133</guid>
      <dc:creator>rozywahana</dc:creator>
      <dc:date>2023-08-01T03:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: LSP:  Replace Last Character with User Specified Character</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12140159#M92134</link>
      <description>&lt;P&gt;I'll take a look tomorrow this is not nearly the same request a your &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12138710#M452484" target="_blank" rel="noopener"&gt;initial&lt;/A&gt;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;mr &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/593837"&gt;@ronjonp&lt;/a&gt; could u help me making lsp for string-replace
;; Example usage
(setq str "abcdeeeabcdeeeabcdeee")
(setq trimmed-str (string-replace str "e" ""))
;; trimmed-str will be "abcdabcdabcd"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 01 Aug 2023 03:14:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lsp-replace-last-character-with-user-specified-character/m-p/12140159#M92134</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2023-08-01T03:14:50Z</dc:date>
    </item>
  </channel>
</rss>

