<?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 How to specify location in string? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-specify-location-in-string/m-p/1315010#M71690</link>
    <description>&lt;P&gt;I'm back to trying to remove "T" from layer names in the Drawing Order.&lt;/P&gt;&lt;P&gt;I have 3 layers:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;T123T
12T3
T123&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will remove all the T's:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;layers = act_map.listLayers()
for lyr in layers:
    if "T" in lyr.name:
        lyr.name = lyr.name.replace("T", "")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I specify the first position in the string? so I'm left with:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;123T
12T3
123&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Aug 2023 12:40:59 GMT</pubDate>
    <dc:creator>Davec43</dc:creator>
    <dc:date>2023-08-03T12:40:59Z</dc:date>
    <item>
      <title>How to specify location in string?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-specify-location-in-string/m-p/1315010#M71690</link>
      <description>&lt;P&gt;I'm back to trying to remove "T" from layer names in the Drawing Order.&lt;/P&gt;&lt;P&gt;I have 3 layers:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;T123T
12T3
T123&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will remove all the T's:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;layers = act_map.listLayers()
for lyr in layers:
    if "T" in lyr.name:
        lyr.name = lyr.name.replace("T", "")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I specify the first position in the string? so I'm left with:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;123T
12T3
123&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 12:40:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-specify-location-in-string/m-p/1315010#M71690</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-08-03T12:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify location in string?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-specify-location-in-string/m-p/1315045#M71695</link>
      <description>&lt;P&gt;Try this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;layer.name is a string. So you can ask for the "T" in the first letter with ==. If this is true you change the name. But you will do this only ones. For the first letter... This is why you add the 1 in ("T","",1).&lt;/P&gt;&lt;LI-CODE lang="c"&gt;layers = act_map.listLayers()
for lyr in layers:
    if "T" == lyr.name[0]:
        lyr.name = lyr.name.replace("T", "", 1)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 14:10:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-specify-location-in-string/m-p/1315045#M71695</guid>
      <dc:creator>SvenR</dc:creator>
      <dc:date>2023-08-03T14:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify location in string?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-specify-location-in-string/m-p/1315055#M71698</link>
      <description>&lt;P&gt;Awesome it worked, thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 14:27:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-specify-location-in-string/m-p/1315055#M71698</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-08-03T14:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify location in string?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-specify-location-in-string/m-p/1315056#M71699</link>
      <description>&lt;P&gt;You can directly index into a String, but that doesn‘t seem to be what you want to do anyway, so your question is confusing. Iterators are just one way of splitting at whitespace. There are many short command when working with iterators, such as ”for element in iter“, collect, map, and so on&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://mobdro.bio/" target="_blank" rel="noopener"&gt;https://mobdro.bio/&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2023 06:00:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-specify-location-in-string/m-p/1315056#M71699</guid>
      <dc:creator>shawinfra</dc:creator>
      <dc:date>2023-08-07T06:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify location in string?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-specify-location-in-string/m-p/1315846#M71787</link>
      <description>&lt;P&gt;You can also use the &lt;A href="https://www.w3schools.com/python/ref_string_lstrip.asp" target="_self"&gt;string.lstrip&lt;/A&gt;&amp;nbsp;(left strip) method. This will remove the given character from the start of a string, leaving the string untouched if it doesn't start with that character.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;layers = [l.lstrip("T") for l in act_map.listLayers()]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Aug 2023 12:38:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-specify-location-in-string/m-p/1315846#M71787</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2023-08-06T12:38:24Z</dc:date>
    </item>
  </channel>
</rss>

