HOW TO

Remove and replace characters from a field in an attribute table

Last Published: December 3, 2020

Summary

The instructions provided describe how to remove and replace characters from a field in an attribute table using the Field Calculator in ArcMap. In this example, the hyphen character ( - ) is replaced and removed to provide better readability.

Image of the field with character to remove

Procedure

  1. Open ArcMap.
  2. Right-click the selected layer in Table Of Contents, and select Open Attribute Table.
Image of Table of Contents, select Open Attribute Table
  1. Start an edit session via the Editor toolbar for the selected layer.
Image of starting an edit session via the Editor toolbar
  1. Right-click the field, and select Field Calculator....
Image of Select Field Calculator
  1. In Field Calculator, click the Python parser, and double-click the desired field name to insert the field name in the codeblock.
  2. Click the String radio button, and in the Functions list, click .replace().
  3. Within the bracket in .replace(), type "-"," " to replace hyphens with a space, as shown below.
Code:
 ![FieldName]!.replace("-"," ") 
Image of replacing hyphens with a space
  1. Click OK. The hyphens are removed.
Image of hyphens removed
  1. In the Editor toolbar, select Stop Editing and click Save Edits to save the changes.

Article ID: 000012530

Software:
  • ArcMap

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options