[GIS] How to truncate extension off in-line variable %name% in ModelBuilder

arcgis-10.2arcgis-desktoparcmapmodelbuilder

I have seen similar questions but no clear answer and I am afraid that this can't be done in ModelBuilder alone.

Is there a way to truncate the extension off the %name% variable? I am working with .tif and .asc files that I use to resample and do zonal statistics but since they have file extensions the tools throw an error when using %name% and I am forced to use %n% and then rename the files using R. I have tried "%name%"[x:y] as suggested in another question but doesn't work.

Any suggestions? This is ArcMap 10.2 but had the same problem in 10.0

Best Answer

You could also use "%Name%".replace(".tif","") in Calculate Value in ModelBuilder.

Related Question