0

I am using ArcMap 10.7.1.

I want to insert a space into a string between specific parts of the string using Field Calculator:

!FIELD! .replace("F'target", "F 'target")

Neither 'F' or 'target' are at beginning or end of string, those characters are in the middle of a string.

I run the calculation, and nothing happens. I've tried to escape the single quote, but no difference. Do I need a wildcard tag at beginning and end of the substring?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Aug 27, 2021 at 19:43

1 Answer 1

3

No need for wildcards, the replace() method searches the whole string, as you can see if you test it out in the Python interpreter:

>>> "Test string with F'target in the middle".replace("F'target", "F 'target")
"Test string with F 'target in the middle"

Double check that the exact string F'target does indeed appear in your field.

answered Aug 27, 2021 at 19:48
1
  • i looked closely and I found the problem, the first single quote was " ‘ " instead of " ' " Not sure how that got there but that was it. Commented Aug 27, 2021 at 20:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.