Quantcast
Channel: Question and Answer » modelbuilder
Viewing all articles
Browse latest Browse all 135

How to extract portion of a string for a field value

$
0
0

This is simple but driving me mad. I am using Modelbuilder to iterate through a folder of feature classes, and need to add a field that extracts a portion of the filename.

Example:
CF0140r01.shp
I want to add a field to the its table that is titled Image, and wish to just extract the portion of the file name from character positions 3-6 so the resulting field has a value of 0140

I have LOTS of these files, and each one has the Image number embedded in the file name, always at the same positions (two leading Text characters, 4 digits for Image number, three trailing characters with more information)


Viewing all articles
Browse latest Browse all 135

Trending Articles