how to slice a label field

3926
2
02-16-2011 03:56 PM
wilfredwaters
New Contributor III
I have a field 'Name' where the first two letters of every string are 'ID'. Following 'ID' are between 1 and 2 characters, for example 'ID1' or 'ID11'. I want to create a label expression for arcGIS 10 that slices everything after ID. In python this is something like Name [2:] to return everything after the 2nd character. The label expression generator, however, only takes VBscript. Does anyone know what to do?

Wil
Tags (2)
0 Kudos
2 Replies
wilfredwaters
New Contributor III
i fixed it by manually making a new field then field calculating it with !name![2:] (python was turned on as the parser. argGIS should allow a python parser in the expression generator
0 Kudos
RussellHooper
New Contributor II
In the "Label Expression" window, with Python selected as the Parser, type:

[Name].lstrip('ID']


This should remove ID from all of your labels.

R
0 Kudos