3

How would I populate a text field with double quotes using the Field Calculator. For example, I want to populate a field as 24". Is there a way to populate fields using the field calculator with this value? If I use "24"", I get an error because of the two double quotes.

  • Found the answer... "24\"" ... need to escape out the double quote. – boyle.matt Apr 25 '14 at 18:59
  • Thanks for the quick replies, didn't know you could use single quotes with python, easy solution! – boyle.matt Apr 25 '14 at 19:03
  • In the VB parser it's "24""" that's "" to insert a " and " to finish so 3x". Another option is chr(42) where 42 is the ASCII code for " so "24" & chr(42) – Michael Stimson Apr 26 '14 at 2:49
4

Change the parser to Python using the radio button at the top of the field calculator window, then use single-quotes to enclose your text:

'24"'

Python allows you to use either single- or double-quotes to enclose a string. If you wanted to use an apostrophe in your text field, you would use double-quotes instead:

"Owner's"
3

with python, you can use either " " or ' ' to identify your text

so you could do it like this :

'24"'

but the best method if you don't want to play with \' and \" when you have both ' and " in your string, is to use the triple """

""" 24's" """

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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