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.mattApr 25, 2014 at 18:59
-
Thanks for the quick replies, didn't know you could use single quotes with python, easy solution!– boyle.mattApr 25, 2014 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 StimsonApr 26, 2014 at 2:49
2 Answers
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"
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" """