Changing the case of text field values
This task will convert the following three strings: example text, EXAMPLE TEXT, or eXAMPLE tEXT to Example Text.
Steps:
- Right-click the layer or table you want to edit and open its table.
-
Add a new text field to store the new string values.
If you are editing, stop the current edit session. Click Table Options and click Add Field. Name the field, set the type to Text, then specify a length.
- Right-click the field heading for the field you just added and click Field Calculator.
- Choose Python as your scripting language.
-
Paste the following code into the text box on the dialog box:
' '.join([i.capitalize() for i in !FieldName!.split(' ')])
- Click OK.
Related Topics
3/18/2014