<?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: Proper case for names beginning with Mc, like McDavid in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/proper-case-for-names-beginning-with-mc-like/m-p/1381874#M69864</link>
    <description>&lt;P&gt;That's what I get for posting without testing lol. Glad it works.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2024 20:36:20 GMT</pubDate>
    <dc:creator>AlfredBaldenweck</dc:creator>
    <dc:date>2024-02-13T20:36:20Z</dc:date>
    <item>
      <title>Proper case for names beginning with Mc, like McDavid</title>
      <link>https://community.esri.com/t5/python-questions/proper-case-for-names-beginning-with-mc-like/m-p/1381730#M69858</link>
      <description>&lt;P&gt;I have a featureclass of street names where all of the names are in uppercase.&amp;nbsp; I can set a label class using an expression STN begins with "MC%", but I want python to label the streets starting with MC to convert the label to proper case, for example, MCDAVID would be McDavid.&amp;nbsp; Does anyone have a suggestion for using python to do this?&amp;nbsp; I've already tried using [STN].title(), but that yields Mcdavid.&amp;nbsp; Thanks for the suggestions.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 18:09:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-case-for-names-beginning-with-mc-like/m-p/1381730#M69858</guid>
      <dc:creator>Shauna-RaeBrown</dc:creator>
      <dc:date>2024-02-13T18:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Proper case for names beginning with Mc, like McDavid</title>
      <link>https://community.esri.com/t5/python-questions/proper-case-for-names-beginning-with-mc-like/m-p/1381809#M69859</link>
      <description>&lt;P&gt;You could always do a replace?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;STN.replace("MC", "Mc")&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 13 Feb 2024 19:24:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-case-for-names-beginning-with-mc-like/m-p/1381809#M69859</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2024-02-13T19:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: Proper case for names beginning with Mc, like McDavid</title>
      <link>https://community.esri.com/t5/python-questions/proper-case-for-names-beginning-with-mc-like/m-p/1381831#M69860</link>
      <description>&lt;P&gt;Probably a better way, but his is how I've handled that in the past.&lt;/P&gt;&lt;P&gt;I have a dictionary of the names that get whacked out when title casing and substitute the value when has a matching key.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;subDict = { 
                "MCMURRAY ST": "McMurray St",
                "MCMURRAY AVE": "McMurray Ave",
                "MCINTOSH CT": "McIntosh Ct",
                "MCEWAN DR": "McEwan Dr",
                "MCPHERSON AVE": "McPherson Ave",
                "MCCLELLAN ST": "McClellen St",
                "BY-PASS": "Bypass Hwy         SR 240",
                "O'CONNOR ST":"O'Connor St",
                "MCMURRAY": "McMurray",
                "MCINTOSH": "McIntosh",
                "MCEWAN": "McEwan",
                "MCPHERSON": "McPherson",
                "MCCLELLAN": "McClellen",
                "O'CONNOR":"O'Connor"
                }
def FindLabel ( [Street] ):
      st = [Street]
      label = [Street].title()
      if st in subDict.keys():
             label = subDict[st]
      return label&lt;/LI-CODE&gt;&lt;P&gt;R_&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 20:01:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-case-for-names-beginning-with-mc-like/m-p/1381831#M69860</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2024-02-13T20:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Proper case for names beginning with Mc, like McDavid</title>
      <link>https://community.esri.com/t5/python-questions/proper-case-for-names-beginning-with-mc-like/m-p/1381844#M69861</link>
      <description>&lt;P&gt;That partially works.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;STN.replace("MC", "Mc")&lt;/LI-CODE&gt;&lt;P&gt;returns McDAVID.&amp;nbsp; What I want is McDavid.&amp;nbsp; Thanks for your help.&amp;nbsp; I'll keep trying.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 20:09:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-case-for-names-beginning-with-mc-like/m-p/1381844#M69861</guid>
      <dc:creator>Shauna-RaeBrown</dc:creator>
      <dc:date>2024-02-13T20:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proper case for names beginning with Mc, like McDavid</title>
      <link>https://community.esri.com/t5/python-questions/proper-case-for-names-beginning-with-mc-like/m-p/1381850#M69862</link>
      <description>&lt;P&gt;Ohhh it's all in caps. Something like this should work?&lt;/P&gt;&lt;P&gt;I'm not putting in an if statement because you have it handled by the Label class query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;nam = STN.lower()
nam = nam.replace("mc", "Mc")
nam = nam[0:2] + nam[2].capitalize() + nam[3:]
return nam&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edited to change my slicing since I mixed it up a bit.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 20:16:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-case-for-names-beginning-with-mc-like/m-p/1381850#M69862</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2024-02-13T20:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proper case for names beginning with Mc, like McDavid</title>
      <link>https://community.esri.com/t5/python-questions/proper-case-for-names-beginning-with-mc-like/m-p/1381871#M69863</link>
      <description>&lt;P&gt;Your little script is almost correct.&amp;nbsp; I had to change nam[0:1] to nam[0:2], because the "c" got skipped and yielded MDavid.&amp;nbsp; The following works, and yields McDavid.&amp;nbsp; Thanks so much!!!&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def FindLabel ( [STN] ):
    nam = [STN].lower()
    nam = nam.replace("mc", "Mc")
    nam = nam[0:2] + nam[2].capitalize() + nam[3:]
    return nam&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 20:34:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-case-for-names-beginning-with-mc-like/m-p/1381871#M69863</guid>
      <dc:creator>Shauna-RaeBrown</dc:creator>
      <dc:date>2024-02-13T20:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proper case for names beginning with Mc, like McDavid</title>
      <link>https://community.esri.com/t5/python-questions/proper-case-for-names-beginning-with-mc-like/m-p/1381874#M69864</link>
      <description>&lt;P&gt;That's what I get for posting without testing lol. Glad it works.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 20:36:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-case-for-names-beginning-with-mc-like/m-p/1381874#M69864</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2024-02-13T20:36:20Z</dc:date>
    </item>
  </channel>
</rss>

