Search code examples
nant

Determine '\' position in string


I'm trying to get the directory name from a path string using nant. However, whenever I use the following:

<property name="lastBackSlash" value="${string::last-index-of('${foldername}', '\')}" />

... this returns -1. I am sure the foldername contains a path with backslashes.

Am I doing something wrong?


Solution

  • Too many dollar signs, assuming of course, that foldername is a property.

    <property name="lastBackSlash" value="${string::last-index-of(foldername, '\')}" />