Below you will find some materials presented at our 2022 User Conference ArcGIS Pro: Advanced Map Labeling technical workshop.
Use the Proper() Arcade function to convert the first letter of each word to uppercase and the rest of the letters to lowercase. Below is the more complex expression we used for street labeling, preserving the directionals (NW, SW, etc) as uppercase and converting the numbered streets (12th, 21st, etc) to lowercase.
//split label into words
var words = split(upper($feature.ROUTENAME), " ")
//provide list of directions to be upper case
var upperWords = ["N", "NW", "W", "SW", "S", "SE", "E", "NE", "US"]
// provide list of ordinals to be lower case
var lowerWords = ["1ST", "2ND", "3RD", "4TH", "5TH", "6TH", "7TH", "8TH", "9TH", "0TH", "1TH", "2TH", "3TH" ]
var label = ""
// loop through words
for (var i in words)
{
var word = words[i]
/* determine whether they'll be upper or lower case if lower check the length is long enough and then
check the three right hand characters to ensure match lowerWords variable */
var isUpper = indexof(upperWords, word) > -1
var isLower = count(word) >= 3 && indexof(lowerWords, right(word, 3)) > -1
// reconstruct label
if (isUpper)
label += word + " "
else if (isLower)
label += lower(word) + " "
else
label += proper(word) + " "
}
// return it to the label engine
return label
This expression uses the Right() and Count() Arcade functions to extract the characters after the word "Interstate " in the STREETNAME field:
Right($feature.STREETNAME, Count($feature.STREETNAME) - 11)
This expression was used in our alternate expression of our abbreviation settings in our Institutes point layer.
var eduSearchTerms = ["SCHOOL", "ACADEMY", "COLLEGIATE", "COLLEGE", "UNIVERSITY"]
var relSearchTerms = ["CHURCH", "MOSQUE", "SYNAGOGUE", "MONASTRY", "TEMPLE", "TABERNACLE", "WORSHIP"]
for (var i in eduSearchTerms)
{
if(find(eduSearchTerms[i], upper($feature.Name2)) > -1)
return "Edu."
}
for (var i in relSearchTerms)
{
if(find(relSearchTerms[i], upper($feature.Name2)) > -1)
return "Rel."
}
return proper($feature.Name2)
See Esri Knowledge Base article 30494.
Help article: Label with the Maplex Label Engine
Quick-start Tutorial: Label your map