1

I wonder how to delete a word (or the last 5 characters) using the field calculator in ArcGIS 10.2. I have a column such as:

Paris City; London City; Berlin City

I need to remove "City", to be left with Paris, London, Berlin.

Any tips on doing this automatically?

marked as duplicate by PolyGeo arcgis-desktop May 18 '17 at 8:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Do a find and replace on the field when in table view mode. Click on the options button in top left. – Hornbydd May 18 '17 at 7:55
4

Using the python parser type:

!Field_name![:-5]

That should return all but the last five characters regardless of what they are.

This uses Python slice notation.

5

In the field calculator choose Python Parser and write the following formula:

!Field_Name!.replace(" City","")

Where: !Field_Name! is the name of the field that contains city names.

Not the answer you're looking for? Browse other questions tagged or ask your own question.