English

How To: Remove and replace characters from a field in an attribute table

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 from a field to provide better readability.
[O-Image]

Procedure

  1. Open ArcMap.
  2. Right-click the selected layer in the Table Of Contents, and select Open Attribute Table.
    [O-Image]
  3. Start an edit session via the Editor toolbar for the selected layer.
    [O-Image]
  4. Right-click the field, and select Field Calculator.
    [O-Image]
  5. In the Field Calculator, click the Python parser, and double-click the desired field name to insert the field name in the codeblock. Click the String radio button, and in the Functions list, click .replace().

    Note:
    Within the bracket in .replace(), type "-"," " to replace hyphens with a space.
    Code:
    ![FieldName]!.replace("-"," ")



    [O-Image]
  6. Click OK. The hyphens are removed.
    [O-Image]
  7. In the Editor toolbar, select Stop Editing and Save Edits to keep the changes.

Related Information