tut: Text Case

(return to Cartography Tutorials page)

Converting Text to Upper, Lower or Proper Case

Databases can contain text fields in ALL CAPS, all lower case, or a Mix of Upper and Lower Case lettering (known as 'Proper Case'). For labeling it is often useful to change the display of these text strings. If you need to change the style of the text (i.e., from All Cap to Proper Case, etc.) you can use the following methods to either calculate new values into an attribute field, or you can create a custom Label Expression (which will reformat the text on the fly)

For the examples below, the text field being reformatted is titled NAME - for other fields simply replace [NAME] with the appropriate field name, i.e., [My_Field].

 

To display as ALL CAP or all lowercase:

        Open the Layer Properties

        Select the Labels tab

        Click on the Expression... button

 

For all UPPER case (Bob becomes BOB, bob becomes BOB)
        In the Expression box enter:

                    Ucase ( [NAME] )

 

For all lower case (Bob becomes bob, BOB becomes bob)
         In the Expression box enter:

                    Lcase ( [NAME] )

 

These same expressions work in the field calculator if you wish to actually change the values of the attribute table (or create a new field).

 

 

To display as Proper (or Title) Case (bob becomes Bob, BOB becomes Bob)

        Open the Layer Properties

        Select the Labels tab

        Click on the Expression... button

        For Parser: choose Python

       Check the box for Advanced

       In the Expression box delete all of the contents and replace them with the following (again, replace the field name as needed):

def FindLabel ( [NAME] ):

  S = [NAME]

  S = S.title()

  return S

 

If you wish to add text to the field values you can do so in the Expression code (bob becomes My Name Is Bob):
Note that Python uses the + symbol (instead of the &)

def FindLabel ( [NAME] ):

  S = [NAME]

  S = S.title()

  return "My Name Is " + S

 

If you wish to add a line feed (carriage return) use '\n'
Note the use of double quotes for the text string and single quotes for the new line command

def FindLabel ( [NAME] ):

  S = [NAME]

  S = S.title()

  return "My Name Is " + '\n' + S

 

 

To display as ALL CAPITAL PROPER CASE

There is not an easy way to reformat a text string to the ALL CAPITAL PROPER CASE style... but there are some workarounds:

1) The simplest is to use one of the fonts that uses this style. In ArcGIS Copperplate Gothic Bold, Copperplate Gothic Light, Orator Std., and Trajan Pro all use the ALL CAPITAL PROPER CASE lettering style (there are no lower case letters in these fonts at all, just smaller upper case letters).

2) You can also use formatting tags within the text block to set the size or the scale of the first letter of each word larger than the other letters. This has to be done for each, individual word, so isn't a good option for a lot of text, but can work for small strings:

To increase the size of a single letter use the FNT size tag before and after the letter:

           <ACP><FNT size="18">s</FNT><FNT size="12">ome</FNT><FNT size="18"> t</FNT><FNT size="12">ext</FNT></ACP>

The FNT scale tag can also be used:

          <ACP><FNT scale="200">s</FNT><FNT scale="100">ome</FNT><FNT scale="200"> t</FNT><FNT scale="100">ext</FNT></ACP>

3) You can also create the text block in Word and imbed the word doc as an object. Word has a text formatting option for Small Caps that will create the All cap proper case.

 

(return to Cartography Tutorials page)