<?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: Replace in Field Calculator in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811105#M33590</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;do you by chance have a newline character in there?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;print(a)&lt;BR /&gt;1234 &lt;BR /&gt; 56&lt;/P&gt;&lt;P&gt;a.replace("\n","").split(" ")[0]&lt;BR /&gt;'1234'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the values aren't stacked in the first place and replacing a single space with nothing doesn't work, then you may have multiple spaces as a separator or esoteric non-printable characters as a separator&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At which point.... slice how many characters off that you want from whatever end&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a = "1234 56"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a[:4]&amp;nbsp; &amp;nbsp; &amp;nbsp; # 1234&lt;/P&gt;&lt;P&gt;a[-2:]&amp;nbsp; &amp;nbsp; &amp;nbsp;# 56&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Mar 2020 21:15:57 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2020-03-05T21:15:57Z</dc:date>
    <item>
      <title>Replace in Field Calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811096#M33581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I am trying to move an address number field from a text to an integer field. The issue I am having is some of the addresses in the text field have spaces in them followed by a unit number. I already have another field with unit numbers so trying to figure out a way to mass&amp;nbsp;updates&amp;nbsp;these features. There is about 85000 of them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Address Num example: 12345 01&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there some sort of function (replace, trim?) where I can search for the space and delete everything after it in my text address number field?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Justin&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2020 23:56:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811096#M33581</guid>
      <dc:creator>JustinNettleton1</dc:creator>
      <dc:date>2020-03-04T23:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: Replace in Field Calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811097#M33582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="string token"&gt;"12345 01"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&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="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;   &lt;SPAN class="comment token"&gt;# ---- keep as string&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;'12345'&lt;/SPAN&gt;

int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"12345 01"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&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="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;  &lt;SPAN class="comment token"&gt;# ---- convert to integer&lt;/SPAN&gt;
&lt;SPAN class="number token"&gt;12345&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;might be what you are looking for, in field calculator-ese or the 2nd one if you want integers&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;!YourFieldWithTheValues!&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&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="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&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>Sun, 12 Dec 2021 09:31:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811097#M33582</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T09:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Replace in Field Calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811098#M33583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan,&amp;nbsp;&lt;/P&gt;&lt;P&gt;the calculation worked but now it is showing as 12345 *0.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doesn't look like it deleted anything after the space.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 15:19:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811098#M33583</guid>
      <dc:creator>JustinNettleton1</dc:creator>
      <dc:date>2020-03-05T15:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: Replace in Field Calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811099#M33584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;split, splits on the space [0] keeps the first bit, so [1] will keep the second bit.&lt;/P&gt;&lt;P&gt;Now if you have nulls and other 'stuff' in there, then either query for the good stuff only, or the field calculation will have to be edited&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 16:34:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811099#M33584</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-05T16:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Replace in Field Calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811100#M33585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok, but I don't want to keep anything after the space. I want the space any anything after it deleted from the field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't have any nulls or anything.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 16:39:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811100#M33585</guid>
      <dc:creator>JustinNettleton1</dc:creator>
      <dc:date>2020-03-05T16:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Replace in Field Calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811101#M33586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"12345 01".split(" ")[0]&lt;BR /&gt;'12345'&lt;/P&gt;&lt;P&gt;visually, splitting values in a 'junk' field so that values appear in the 'More_Junk' field&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image" height="232" src="https://community.esri.com/legacyfs/online/484141_split_example.png" width="943" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 16:52:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811101#M33586</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-05T16:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Replace in Field Calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811102#M33587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Following your instructions it still isn't getting rid of anything. As you can see it is stacking the characters after the space.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/484194_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 19:52:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811102#M33587</guid>
      <dc:creator>JustinNettleton1</dc:creator>
      <dc:date>2020-03-05T19:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: Replace in Field Calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811103#M33588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So your source field is also called ...Junk... ??&lt;/P&gt;&lt;P&gt;Maybe you had better show what is in that field as well&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 20:21:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811103#M33588</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-05T20:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Replace in Field Calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811104#M33589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My source field is Call AddrNumber, I just copied it a new field called junk to copy exactly how you had it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Source field looks the same as the new junk field after the calculation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/484200_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;Sou&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 20:43:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811104#M33589</guid>
      <dc:creator>JustinNettleton1</dc:creator>
      <dc:date>2020-03-05T20:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: Replace in Field Calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811105#M33590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;do you by chance have a newline character in there?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;print(a)&lt;BR /&gt;1234 &lt;BR /&gt; 56&lt;/P&gt;&lt;P&gt;a.replace("\n","").split(" ")[0]&lt;BR /&gt;'1234'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the values aren't stacked in the first place and replacing a single space with nothing doesn't work, then you may have multiple spaces as a separator or esoteric non-printable characters as a separator&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At which point.... slice how many characters off that you want from whatever end&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a = "1234 56"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a[:4]&amp;nbsp; &amp;nbsp; &amp;nbsp; # 1234&lt;/P&gt;&lt;P&gt;a[-2:]&amp;nbsp; &amp;nbsp; &amp;nbsp;# 56&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 21:15:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811105#M33590</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-05T21:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: Replace in Field Calculator</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811106#M33591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This did it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for all the help.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 22:52:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/replace-in-field-calculator/m-p/811106#M33591</guid>
      <dc:creator>JustinNettleton1</dc:creator>
      <dc:date>2020-03-05T22:52:14Z</dc:date>
    </item>
  </channel>
</rss>

