In a feature class field (screenshot below), I'd like to know how I can get a count of the alpha characters in each record and calculate it to a new field. I have a "FieldCount" field that calculates the total number of characters in the ENGPLANDWG field. I'd like to do the same thing but just for alpha characters where "F63Y" would calculate to 2 (F & Y). I'm using ArcGIS 10.2.2.
This is straight python, so would have been better to ask this on Stack Overflow, however this should work for you.
In your field calculator, select Python Parser and Show Code-block.
In Pre-logic script code:
import string def count_alphas(mystring): i = 0 for char in mystring: if char in string.ascii_letters: i += 1 return i
And in the expression: