<?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: Split string at point where character appears in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646486#M21597</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If ALL subdivisions end with "Sec X", you can split the string by spaces and grab only the last 2 words:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; value = 'Lakeview Sec 2'
&amp;gt;&amp;gt;&amp;gt; section = ' '.join(value.split()[-2:])
&amp;gt;&amp;gt;&amp;gt; print section
Sec 2
&amp;gt;&amp;gt;&amp;gt; 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So in the Field Calculator "Section" field would be (Be sure to set the parser to Python):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
" ".join(!Subdivision!.split()[-2:])
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT:&amp;nbsp; Just a thought, if you have a Sections feature class you can do a spatial join of your sections to your subdivisions.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 03:26:09 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-12-12T03:26:09Z</dc:date>
    <item>
      <title>Split string at point where character appears</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646480#M21591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a large dataset in ArcGIS10 with numeric characters followed by an asterisk and then a series of either numbers or letters.&amp;nbsp; I would like to be able to create a new field with only the characters to the right of the asterisk.&amp;nbsp; The left() and right() functions by themselves don't work for me, because there is no standard number of characters before or after the asterisk.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Example of data...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;201*H&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1296*CH&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;37901*001&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would like to create a new field with...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;H&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CH&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;001&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Joe&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Oct 2012 13:00:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646480#M21591</guid>
      <dc:creator>JoeMeny</dc:creator>
      <dc:date>2012-10-15T13:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Split string at point where character appears</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646481#M21592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a large dataset in ArcGIS10 with numeric characters followed by an asterisk and then a series of either numbers or letters.&amp;nbsp; I would like to be able to create a new field with only the characters to the right of the asterisk.&amp;nbsp; The left() and right() functions by themselves don't work for me, because there is no standard number of characters before or after the asterisk.&lt;BR /&gt;&lt;BR /&gt;Example of data...&lt;BR /&gt;&lt;BR /&gt;201*H&lt;BR /&gt;1296*CH&lt;BR /&gt;37901*001&lt;BR /&gt;&lt;BR /&gt;Would like to create a new field with...&lt;BR /&gt;&lt;BR /&gt;H&lt;BR /&gt;CH&lt;BR /&gt;001&lt;BR /&gt;&lt;BR /&gt;Thanks for your help,&lt;BR /&gt;Joe&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Joe,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could use the field calculator to accomplish this.&amp;nbsp; Be sure to set the Parser to Python and try this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;!field_name!.split("*")[-1]&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will return only the values after the asterisk.&amp;nbsp; If you need to get everything before the asterisk, use [0] instead of [-1].&amp;nbsp; Also, be sure to replace field_name with the name of the field that you are wanting to split.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Oct 2012 13:14:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646481#M21592</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2012-10-15T13:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Split string at point where character appears</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646482#M21593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks that worked, just what I was looking for.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Oct 2012 13:18:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646482#M21593</guid>
      <dc:creator>JoeMeny</dc:creator>
      <dc:date>2012-10-15T13:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: Split string at point where character appears</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646483#M21594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I know this is an old thread but it sounds similar to what I have been looking for.&amp;nbsp; If I want to split a string and include the asterisk (in your example) how would I do that?&amp;nbsp; I have a string field and I am trying to calculate a new field with everything from a particular word to the end of the string.&amp;nbsp; Example:&amp;nbsp; Some Subdivision Sec 3; I want Sec 3 in a new field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance for any assistance!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 14:33:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646483#M21594</guid>
      <dc:creator>MelissaJohnson</dc:creator>
      <dc:date>2013-09-26T14:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Split string at point where character appears</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646484#M21595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; Example: Some Subdivision Sec 3; I want Sec 3 in a new field.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you be a little more specific?&amp;nbsp; Could you show an example of the full value in one field and the value you want in your new field?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you saying the &lt;/SPAN&gt;&lt;STRONG&gt;full&lt;/STRONG&gt;&lt;SPAN&gt; field value is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Greenview Estates Subdivision Sec 3;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and you just want just "Sec 3" in the other field?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 14:43:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646484#M21595</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-09-26T14:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Split string at point where character appears</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646485#M21596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes.&amp;nbsp; I have a subdivision name field.&amp;nbsp; Some are just single part subdivisions; eg Lakewood.&amp;nbsp; Others may have sections for example Lakeview Sec 1, Lakeview Sec 2, Lakeview Sec 3.&amp;nbsp; What I want to do is calculate a new field so that it has only the Section in it, for example Sec 1, Sec 2.&amp;nbsp; So ultimately one field will have the subdivision name and one field will have the section number in it.&amp;nbsp; Hope this makes more sense.&amp;nbsp; Some may not have any Section number as in the example of Lakewood above.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 17:09:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646485#M21596</guid>
      <dc:creator>MelissaJohnson</dc:creator>
      <dc:date>2013-09-26T17:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Split string at point where character appears</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646486#M21597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If ALL subdivisions end with "Sec X", you can split the string by spaces and grab only the last 2 words:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; value = 'Lakeview Sec 2'
&amp;gt;&amp;gt;&amp;gt; section = ' '.join(value.split()[-2:])
&amp;gt;&amp;gt;&amp;gt; print section
Sec 2
&amp;gt;&amp;gt;&amp;gt; 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So in the Field Calculator "Section" field would be (Be sure to set the parser to Python):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
" ".join(!Subdivision!.split()[-2:])
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT:&amp;nbsp; Just a thought, if you have a Sections feature class you can do a spatial join of your sections to your subdivisions.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:26:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646486#M21597</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T03:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Split string at point where character appears</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646487#M21598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for replying, no there is no guarantee that it is only 2 words past the word Sec.&amp;nbsp; Some say Sec 3 Rplt or could be even longer if it is a replat of certain lots in the description.&amp;nbsp; I do not have a separate Sections feature.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The only thing I have thought of to do so far, and it seems like a strange way to do it, is to query from my Subdivision names LIKE '%SEC%'. then calculate the filtered results my new field using your code from earlier as such !SUBDIVNAME!.split("SEC")[-1].&amp;nbsp; Then I will have to calculate a new field with "SEC " &amp;amp; [SEC] &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;my "temporary&lt;/SPAN&gt;&lt;SPAN&gt;" field.&amp;nbsp; I was just hoping there was a way to get the SEC word over without the extra step.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Sep 2013 12:53:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646487#M21598</guid>
      <dc:creator>MelissaJohnson</dc:creator>
      <dc:date>2013-09-27T12:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Split string at point where character appears</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646488#M21599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think I have figured out a way to do it.&amp;nbsp; It is not very elegant but I think it should save me some work.&amp;nbsp; Using your code above !field_name!.split("*")[-1], I can Select by Attributes anything with SEC to filter only those records I am interested in, then use your code to calculate a new field as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"SEC" + !SUBDIVNAME!.split("SEC")[-1]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That way I don't have to do an extra step.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for your help!&amp;nbsp; I haven't used Python much.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Sep 2013 15:17:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/split-string-at-point-where-character-appears/m-p/646488#M21599</guid>
      <dc:creator>MelissaJohnson</dc:creator>
      <dc:date>2013-09-27T15:17:45Z</dc:date>
    </item>
  </channel>
</rss>

