I am using 10.0 ArcView and am trying to get the "R" in R12345678910 to drop.
The numbers are in a column in the attribute table and i've always used VB scripting.
I was using Field Calculator.
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityI am using 10.0 ArcView and am trying to get the "R" in R12345678910 to drop.
The numbers are in a column in the attribute table and i've always used VB scripting.
I was using Field Calculator.
>>>'R12345678910'[1:]
'12345678910'
Appending [1:]
to a string in python will remove the initial character. Look up slice in the python help.
To use this in the ArcGIS field calculator, you will need to turn on Python parsing
for the unitCode =
enter
!your_field_name![1:]
VBScript Example:
Right( [FieldName], 11 )
This code will take the 11 characters from the right, and anything left of those 11 characters is omitted.
Python Example:
!FieldName!.lstrip('R')
This code takes a string and removes R from the left/front of it.
Both of these examples should get rid of the R in your strings.
Edit: Regan Sarwas' updated answer works great and is actually more versatile because it can handle more cases.