<?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 Return the character string minus 13 characters in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/return-the-character-string-minus-13-characters/m-p/1080996#M490</link>
    <description>&lt;P&gt;I need the first 13 characters of value %name% to be removed.&amp;nbsp; %name% is the filename of a csv file, a field name in it is equal to the filename minus the first 13 characters.&amp;nbsp; For example: filename&amp;nbsp;"bench325_320_al2o3", field name "al2o3".&amp;nbsp; This model will be running through over 200 hundred csv files and I need the "al2o3" (which will be different for each file) to be a new value for each csv and inserted where the red circle is in the attached image.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture2.JPG" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/18973i79399C437625F3D2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture2.JPG" alt="Capture2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
    <pubDate>Tue, 20 Jul 2021 18:56:13 GMT</pubDate>
    <dc:creator>MillionMap</dc:creator>
    <dc:date>2021-07-20T18:56:13Z</dc:date>
    <item>
      <title>Return the character string minus 13 characters</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/return-the-character-string-minus-13-characters/m-p/1080996#M490</link>
      <description>&lt;P&gt;I need the first 13 characters of value %name% to be removed.&amp;nbsp; %name% is the filename of a csv file, a field name in it is equal to the filename minus the first 13 characters.&amp;nbsp; For example: filename&amp;nbsp;"bench325_320_al2o3", field name "al2o3".&amp;nbsp; This model will be running through over 200 hundred csv files and I need the "al2o3" (which will be different for each file) to be a new value for each csv and inserted where the red circle is in the attached image.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture2.JPG" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/18973i79399C437625F3D2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture2.JPG" alt="Capture2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 18:56:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/return-the-character-string-minus-13-characters/m-p/1080996#M490</guid>
      <dc:creator>MillionMap</dc:creator>
      <dc:date>2021-07-20T18:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Return the character string minus 13 characters</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/return-the-character-string-minus-13-characters/m-p/1081013#M491</link>
      <description>&lt;P&gt;it is rarely a good idea to hardcode a soution without considering the exceptions&lt;/P&gt;&lt;LI-CODE lang="python"&gt;a = "12345678901234567890"
a[:-13]
'1234567'&lt;/LI-CODE&gt;&lt;P&gt;but... here is one&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 19:23:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/return-the-character-string-minus-13-characters/m-p/1081013#M491</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-07-20T19:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Return the character string minus 13 characters</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/return-the-character-string-minus-13-characters/m-p/1081035#M492</link>
      <description>&lt;P&gt;Thanks for the reply but it doesn't work.&amp;nbsp; The amount of characters in the filenames are consistent, so hardcoding in this situation is fine.&amp;nbsp; You're example removes the last 13, I need the first 13 removed and also how it is to be entered in the red circle location.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 19:48:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/return-the-character-string-minus-13-characters/m-p/1081035#M492</guid>
      <dc:creator>MillionMap</dc:creator>
      <dc:date>2021-07-20T19:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: Return the character string minus 13 characters</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/return-the-character-string-minus-13-characters/m-p/1081052#M493</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;a = "12345678901234567890"
a[13:]
'4567890'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can learn a lot about&lt;A href="https://realpython.com/python-strings/" target="_self"&gt; string manipulation here.&lt;/A&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 20:29:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/return-the-character-string-minus-13-characters/m-p/1081052#M493</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-07-20T20:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Return the character string minus 13 characters</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/return-the-character-string-minus-13-characters/m-p/1081062#M494</link>
      <description>&lt;P&gt;To get this to work, use the Calculate Value tool. If your names are consistent as you say, either of these expressions would work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;r"%Name%"[-5:] # last 5 characters
r"%Name%"[13:] # characters 14-end&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and connect the output of the Calculate Value as a precondition to the tool where you will be using the output variable (with % around it, for example %Value%). %Value% is entered in the tool dialog where you had %Name% entered before.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;UPDATE: probably a good idea to connect the variable Name to your Calculate Value tool in the model as a precondition to make sure you have the current value of %Name% used. Also documents the model nicely. I often rename the Calculate Value tool to something like Calculate Value end of Name to make it obvious what's going on in the model.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 21:04:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/return-the-character-string-minus-13-characters/m-p/1081062#M494</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-07-20T21:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Return the character string minus 13 characters</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/return-the-character-string-minus-13-characters/m-p/1081071#M495</link>
      <description>&lt;LI-CODE lang="python"&gt;a[:-13]
a[:13]
a[-13:]
a[13:]&lt;/LI-CODE&gt;&lt;P&gt;by example... you only had 4 options to test replacing "a" with your input string.&lt;/P&gt;&lt;P&gt;Which one worked?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 21:02:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/return-the-character-string-minus-13-characters/m-p/1081071#M495</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-07-20T21:02:21Z</dc:date>
    </item>
  </channel>
</rss>

