Select to view content in your preferred language

Field Calculator - Calculate string length using python syntax.

13209
2
10-25-2013 03:18 PM
BenFerguson
Occasional Contributor
I'm trying to calculate the length of a string in the field calculator using Python syntax.  Normally this is done as len(stringValue).

The calculator shows a function .len()  My question is how is this intended to be used?  I can't seem to find the right syntax.
Tags (2)
0 Kudos
2 Replies
AnthonyGiles
Honored Contributor
Ben,

If the value is coming from a field then the field name needs to be contained in square brackets:

Len( [Field] )

Have a look at thus handy guide:

http://www.esri.com/news/arcuser/0405/files/fieldcalc_1.pdf

Regards

Anthony
0 Kudos
RichardFairhurst
MVP Honored Contributor
For Python use:

len(!FieldName!)

Brackets is only for VB Script.