<?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: Removing last character from a string using VB in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549952#M42983</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help. Appreciate it a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've since managed to get the result I wished for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 May 2018 02:15:28 GMT</pubDate>
    <dc:creator>BryanL</dc:creator>
    <dc:date>2018-05-10T02:15:28Z</dc:date>
    <item>
      <title>Removing last character from a string using VB</title>
      <link>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549945#M42976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to remove "." from various string of different length and would be great if anyone could advise or correct me on the right VB code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example of the data&amp;nbsp;that I am using are as follows;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apple.&lt;/P&gt;&lt;P&gt;Orange.&lt;/P&gt;&lt;P&gt;Pear&lt;/P&gt;&lt;P&gt;Salade&lt;/P&gt;&lt;P&gt;Lime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some of the string above have a "." at the back while others don't and they are all of different Length. The code I've written below simply take away the last character regardless if they are "." or not. Would be great if anyone could help me with this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rTrim( Left ([MACodeLongDescription], LEN([MACodeLongDescription]) -1))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank y'all in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2018 00:47:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549945#M42976</guid>
      <dc:creator>BryanL</dc:creator>
      <dc:date>2018-05-09T00:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: Removing last character from a string using VB</title>
      <link>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549946#M42977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set the python parser in the field calculator.&amp;nbsp; VB is no longer supported, so begin to learn Python and Arcade&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# ---- examples&lt;/SPAN&gt;
a &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Apple.'&lt;/SPAN&gt;

a&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'.'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
Out&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;163&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Apple'&lt;/SPAN&gt;

a &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Pear'&lt;/SPAN&gt;

a&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'.'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
Out&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;165&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Pear'&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now for your field calculation you simply need to include the fieldname in ! ie !OriginalData!&amp;nbsp; and calculate values preferably in a new text field ... like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;!OldField!&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"."&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&amp;nbsp; &lt;SPAN class="comment token"&gt;# ---- no spaces between the double quotes&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:47:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549946#M42977</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T23:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Removing last character from a string using VB</title>
      <link>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549947#M42978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate the fast reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I gave it a go and noticed it didn't work...not too sure if I got it right.&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/406051_image001.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2018 02:49:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549947#M42978</guid>
      <dc:creator>BryanL</dc:creator>
      <dc:date>2018-05-09T02:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Removing last character from a string using VB</title>
      <link>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549948#M42979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why aren't you using the field calculator?&amp;nbsp; (right-click on the field you want to calculate values for and follow on)&lt;/P&gt;&lt;P&gt;In any event&lt;/P&gt;&lt;P&gt;Field name is the field you are calculating into.&lt;/P&gt;&lt;P&gt;The field name used in the expression is the one that contains the old data and it should be different than the field name&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2018 03:30:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549948#M42979</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-05-09T03:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Removing last character from a string using VB</title>
      <link>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549949#M42980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm actually doing this in the model building environment..taking the input field, removing the trailing "." if any and replacing the new values into the original field&lt;/P&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: medium;"&gt;&lt;DIV class=""&gt;&lt;DIV class="" style="color: #555555; background-color: white; border: 1px solid #d8d8d8; margin: 10px 0px 15px -38px; padding: 3px;"&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="/legacyfs/online/406079_image001 (1).png" /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;IMG alt="" class="image-2 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/406081_unnamed.png" /&gt;&lt;/P&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: medium;"&gt;&lt;DIV class=""&gt;&lt;DIV class="" style="color: #555555; background-color: white; border: 1px solid #d8d8d8; margin: 10px 0px 15px -38px; padding: 3px;"&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Apologies for any confusion caused. Just started exploring ArcGis.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2018 03:41:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549949#M42980</guid>
      <dc:creator>BryanL</dc:creator>
      <dc:date>2018-05-09T03:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Removing last character from a string using VB</title>
      <link>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549950#M42981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bryan ... switch the parser to python and set it to string.&amp;nbsp; It isn't a good idea to replace an existing field, add a new field prior to this step and use it to house the results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2018 03:46:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549950#M42981</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-05-09T03:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Removing last character from a string using VB</title>
      <link>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549951#M42982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IN VB:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;IF right([Field],1) = "." then&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;[Field] = Trim(Left([Field],LEN([Field])-1))&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;ELSE&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; &amp;nbsp;[Field]=Trim([Field])&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;END IF&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2018 14:46:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549951#M42982</guid>
      <dc:creator>TedKowal</dc:creator>
      <dc:date>2018-05-09T14:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: Removing last character from a string using VB</title>
      <link>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549952#M42983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help. Appreciate it a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've since managed to get the result I wished for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2018 02:15:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549952#M42983</guid>
      <dc:creator>BryanL</dc:creator>
      <dc:date>2018-05-10T02:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Removing last character from a string using VB</title>
      <link>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549953#M42984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just FYI, another way to remove the right most string in VB is to use the String Reverse method, remove first string using left or mid, then use the string reverse again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a method I have found handy for classifying Schools into Elementary, Junior High, Middle, and High Schools, because a list of schools usually has a format like "MARTIN LUTHER KING JR ELEMENTARY SCHOOL" or "JEFFERSON MIDDLE SCHOOL" so the string reverse method gives you an easy way to work from the right to left by reversing the characters so you are actually working left to right, without having to count characters or string parts.&amp;nbsp; Just make sure to reverse the text again so you arent showing anybody information that looks like "LOOHCS ELDDIM NOSREFFFEJ"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2018 18:47:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-last-character-from-a-string-using-vb/m-p/549953#M42984</guid>
      <dc:creator>KyleGonterwitz</dc:creator>
      <dc:date>2018-06-28T18:47:25Z</dc:date>
    </item>
  </channel>
</rss>

