<?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: VB or Python script for County label that drops the last word in a field in ArcGIS Enterprise Portal Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595788#M8099</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Ok. This works on your sample data.&lt;BR /&gt;&lt;BR /&gt;In Field Calculator...&lt;BR /&gt;&lt;BR /&gt;1. Change parser to python&lt;BR /&gt;2. Check Show codeblock&lt;BR /&gt;3. Paste the code below into Pre-logic script code&lt;BR /&gt;4. in the name = box, enter losemunitype(!name!)&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
def losemunitype( name):
&amp;nbsp;&amp;nbsp;&amp;nbsp; lsttypes = ['County', 'Parish', 'Borough', 'Municipality', 'Census Area', 'City and Borough']
&amp;nbsp;&amp;nbsp;&amp;nbsp; for losetype in lsttypes:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if losetype in name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return name.replace(losetype, '')
&amp;nbsp;&amp;nbsp;&amp;nbsp; return name 

&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AWESOME! Works like a dream! Thanks!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 01:34:37 GMT</pubDate>
    <dc:creator>TiaMorita</dc:creator>
    <dc:date>2021-12-12T01:34:37Z</dc:date>
    <item>
      <title>VB or Python script for County label that drops the last word in a field</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595777#M8088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to create labels for a county field name (called "Name") where I drop the last word "county". For example, the Name field has "Los Angeles County" and "Santa Barbara County" and "Ventura County" - but I just want these labels in my map to read: Los Angeles, Santa Barbara, and Ventura. Is there a way to delete the last characters or just drop the whole word County in a script?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 May 2014 21:14:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595777#M8088</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2014-05-19T21:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: VB or Python script for County label that drops the last word in a field</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595778#M8089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In python:!Name!.split()[:-1]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 May 2014 23:10:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595778#M8089</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2014-05-19T23:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: VB or Python script for County label that drops the last word in a field</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595779#M8090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In vbscript: Left([Name], Len([Name])-6)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Basically this prints anything on the Name field and ignoring the last 6 character, which is dropping off the " county"(note the space character).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope it helps!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Raymond&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 02:43:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595779#M8090</guid>
      <dc:creator>RaymondHuang</dc:creator>
      <dc:date>2014-05-20T02:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: VB or Python script for County label that drops the last word in a field</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595780#M8091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;In python:!Name!.split()[:-1]&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks raymondhuang - I unfortunately get an error message saying "No features found. Could not verify expression."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas? Thanks again.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 17:00:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595780#M8091</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2014-05-20T17:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: VB or Python script for County label that drops the last word in a field</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595781#M8092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Do you mean the VB Script did not work for some records? Can you check if there are any records that doesn't end with " county" or is empty?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Take a screen shot of your attribute table and your field calculator expression for us if you are still facing issues.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Raymond&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 17:16:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595781#M8092</guid>
      <dc:creator>RaymondHuang</dc:creator>
      <dc:date>2014-05-20T17:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: VB or Python script for County label that drops the last word in a field</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595782#M8093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks raymondhuang - I unfortunately get an error message saying "No features found. Could not verify expression."&lt;BR /&gt;&lt;BR /&gt;Any ideas? Thanks again.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello Tia and Raymond,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think you need to use square brackets[] to reference a field in the label expression. Like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;[Name].split()[:-1]&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;But even this code won't work because ArcMap will look for a field called "Name" (which exists) and another field called ":-1" (which does not exist).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would instead use something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;[Name].rstrip(" Country")&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;This code will remove " Country" from the end of the string iff and only if it's actually there. In other words "Los Angeles" goes to "Los Angeles" and "Los Angeles County" goes to "Los Angeles".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know if that works out!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 17:41:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595782#M8093</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2014-05-20T17:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: VB or Python script for County label that drops the last word in a field</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595783#M8094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;In vbscript: Left([Name], Len([Name])-6)&lt;BR /&gt;&lt;BR /&gt;Basically this prints anything on the Name field and ignoring the last 6 character, which is dropping off the " county"(note the space character).&lt;BR /&gt;&lt;BR /&gt;Hope it helps!&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Raymond&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Raymond - Just looking through the County dataset again, I actually see that not all entries end in the word "County". For example I have record names in the "Name" field as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Aleutians West Census Area&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Anchorage Municipality&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Denali Borough&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yakutat City and Borough&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;East Baton Rouge Parish&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Los Angeles County&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;King and Queen County&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Essentially, I would like a python or vbscript where if the name field has "Census Area" or "Municipality" or "Borough" or "City and Borough" or "Parish" or "County" -- those names get dropped from the label.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Possible?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for the help!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 17:53:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595783#M8094</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2014-05-20T17:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: VB or Python script for County label that drops the last word in a field</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595784#M8095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There are a lot of different ways to do this, but I would use this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;[Name].rstrip("Census Area").rstrip("Municipality").rstrip("Borough").rstrip("City and Borough").rstrip("Parish").rstrip("County").rstrip()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The last &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;.rstrip()&lt;/SPAN&gt;&lt;SPAN&gt; gets rid of any spaces at the end of the new string.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 18:46:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595784#M8095</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2014-05-20T18:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: VB or Python script for County label that drops the last word in a field</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595785#M8096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;There are a lot of different ways to do this, but I would use this:&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;[Name].rstrip("Census Area").rstrip("Municipality").rstrip("Borough").rstrip("City and Borough").rstrip("Parish").rstrip("County").rstrip()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;The last &lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;.rstrip()&lt;/SPAN&gt; gets rid of any spaces at the end of the new string.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi - I wish this was it, but it seems to truncate all my County names. I've attached some sample data to assist and also a jpeg of the result I initially got when I tried the script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 20:16:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595785#M8096</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2014-05-20T20:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: VB or Python script for County label that drops the last word in a field</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595786#M8097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok. This works on your sample data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In Field Calculator...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Change parser to python&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Check Show codeblock&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Paste the code below into Pre-logic script code&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. in the name = box, enter losemunitype(!name!)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;def losemunitype( name): &amp;nbsp;&amp;nbsp;&amp;nbsp; lsttypes = ['County', 'Parish', 'Borough', 'Municipality', 'Census Area', 'City and Borough'] &amp;nbsp;&amp;nbsp;&amp;nbsp; for losetype in lsttypes: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if losetype in name: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return name.replace(losetype, '') &amp;nbsp;&amp;nbsp;&amp;nbsp; return name&amp;nbsp; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 22:43:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595786#M8097</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2014-05-20T22:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: VB or Python script for County label that drops the last word in a field</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595787#M8098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Tia,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My apologies, &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;.rstrip()&lt;/SPAN&gt;&lt;SPAN&gt; isn't exactly what I thought it was. You should probably use Greg's &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;.replace()&lt;/SPAN&gt;&lt;SPAN&gt; method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2014 14:27:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595787#M8098</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2014-05-21T14:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: VB or Python script for County label that drops the last word in a field</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595788#M8099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Ok. This works on your sample data.&lt;BR /&gt;&lt;BR /&gt;In Field Calculator...&lt;BR /&gt;&lt;BR /&gt;1. Change parser to python&lt;BR /&gt;2. Check Show codeblock&lt;BR /&gt;3. Paste the code below into Pre-logic script code&lt;BR /&gt;4. in the name = box, enter losemunitype(!name!)&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
def losemunitype( name):
&amp;nbsp;&amp;nbsp;&amp;nbsp; lsttypes = ['County', 'Parish', 'Borough', 'Municipality', 'Census Area', 'City and Borough']
&amp;nbsp;&amp;nbsp;&amp;nbsp; for losetype in lsttypes:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if losetype in name:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return name.replace(losetype, '')
&amp;nbsp;&amp;nbsp;&amp;nbsp; return name 

&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AWESOME! Works like a dream! Thanks!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:34:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595788#M8099</guid>
      <dc:creator>TiaMorita</dc:creator>
      <dc:date>2021-12-12T01:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: VB or Python script for County label that drops the last word in a field</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595789#M8100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Tia,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Great!! I think you should help to mark the post by Greg as the answer. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Raymond&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2014 01:50:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595789#M8100</guid>
      <dc:creator>RaymondHuang</dc:creator>
      <dc:date>2014-05-22T01:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: VB or Python script for County label that drops the last word in a field</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595790#M8101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One caveat to the script: it does what you asked, but if you had any of the words in the list that precede the part you want to retain, it will delete those as well. So 'County of Los Angeles' becomes ' of Los Angeles'. If you want 'County of ' deleted, add that to the list. If you only want 'County' deleted when it's at the end, change this line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if losetype in name:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family:verdana;"&gt;to&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if name.endswith(losetype):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family:verdana;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2014 11:35:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595790#M8101</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2014-05-22T11:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: VB or Python script for County label that drops the last word in a field</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595791#M8102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you only want to remove the suffix strings from the end of the name field, you could modify Greg's script like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def losemunitype( name):
&amp;nbsp;&amp;nbsp;&amp;nbsp; lsttypes = ['County', 'Parish', 'Borough', 'Municipality', 'Census Area', 'City and Borough']
&amp;nbsp;&amp;nbsp;&amp;nbsp; for losetype in lsttypes:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if name.endswith(losetype):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return name[:-len(losetype)].strip()
&amp;nbsp;&amp;nbsp;&amp;nbsp; return name&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]The .strip() just gets rid of the space left over at the new end of the string.[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS. I switch the green check to Greg's original response. I hope that's ok!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:34:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/vb-or-python-script-for-county-label-that-drops/m-p/595791#M8102</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2021-12-12T01:34:40Z</dc:date>
    </item>
  </channel>
</rss>

