<?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: Caluculate Fields in Arcade or Python 3 in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-fields-in-arcade-or-python-3/m-p/1199922#M58231</link>
    <description>&lt;P&gt;“Split, Left, or Mid” are Visual Basic/Excel string functions whose simplicity has frustrated me for decades. With either Python or Arcade you have so many better ways to select portions of strings. In this case, I would use regular expressions to match a pattern, e.g. in Python:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;import re&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;string = "North Miami Beach PB 44-22 LOT SIZE 21815"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# match one or more + digits \d on either side of - and save them in two groups ()&lt;BR /&gt;match = re.search('(\d+)-(\d+)', string)&amp;nbsp;&lt;BR /&gt;p1 =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;match.group(1) &amp;nbsp; &amp;nbsp; #&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;'44'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;p2 = match.group(2) &amp;nbsp; &amp;nbsp; #&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;'22'&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;— Andy&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Aug 2022 16:41:09 GMT</pubDate>
    <dc:creator>AndyAnderson</dc:creator>
    <dc:date>2022-08-05T16:41:09Z</dc:date>
    <item>
      <title>Calculate Fields in Arcade or Python 3</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-fields-in-arcade-or-python-3/m-p/1199889#M58225</link>
      <description>&lt;P&gt;I would like to create a hyperlink to display platbook pages. In order to do this, I must find a way to pull in the values within a paragraph from an existing field, then use the calculate field tool to separate the pages that would each be recorded in to newly created fields.&lt;/P&gt;&lt;P&gt;The problem is that I am not sure how to search for special characters in a paragraph using either ARCADE or PYTHON 3 in ArcGIS Pro. For example, how could I search for a the "-" character within a paragraph to find/separate the 44 and 42 values within the following string "North Miami Beach PB 44-42 LOT SIZE 21815" ?&lt;/P&gt;&lt;P&gt;I was thinking maybe helpers like Split, Left, or Mid would be used. It has been tricky because the values that I would try separate are not always in the same position when doing a character count.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any insight in to how to get started on this would be helpful.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 18:01:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-fields-in-arcade-or-python-3/m-p/1199889#M58225</guid>
      <dc:creator>SibGISAdmin</dc:creator>
      <dc:date>2022-08-05T18:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Caluculate Fields in Arcade or Python 3</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-fields-in-arcade-or-python-3/m-p/1199919#M58230</link>
      <description>&lt;P&gt;The basic idea, could be done much shorter, but it is easier to see the steps in full first.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# basically [i.split("-") for i in p.split(" ") if i.count("-") == 1]

# code block
def spl(p, as_int=True):
    """splitter"""
    s = p.split(" ")
    if len(s) == 0:
        return p
    for i in s:
        if i.count("-") == 1:
            l, r = i.split("-")
            if as_int:
                l, r = int(l), int(r)
    return l, r

# expression
# spl(!YourFieldName!)

# example

p = 'North Miami Beach PB 44-22 LOT SIZE 21815'
spl(p)
(44, 22)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 05 Aug 2022 16:38:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-fields-in-arcade-or-python-3/m-p/1199919#M58230</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-08-05T16:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Caluculate Fields in Arcade or Python 3</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-fields-in-arcade-or-python-3/m-p/1199922#M58231</link>
      <description>&lt;P&gt;“Split, Left, or Mid” are Visual Basic/Excel string functions whose simplicity has frustrated me for decades. With either Python or Arcade you have so many better ways to select portions of strings. In this case, I would use regular expressions to match a pattern, e.g. in Python:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;import re&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;string = "North Miami Beach PB 44-22 LOT SIZE 21815"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# match one or more + digits \d on either side of - and save them in two groups ()&lt;BR /&gt;match = re.search('(\d+)-(\d+)', string)&amp;nbsp;&lt;BR /&gt;p1 =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;match.group(1) &amp;nbsp; &amp;nbsp; #&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;'44'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;p2 = match.group(2) &amp;nbsp; &amp;nbsp; #&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;'22'&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;— Andy&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 16:41:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-fields-in-arcade-or-python-3/m-p/1199922#M58231</guid>
      <dc:creator>AndyAnderson</dc:creator>
      <dc:date>2022-08-05T16:41:09Z</dc:date>
    </item>
  </channel>
</rss>

