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?

有帮助吗?

解决方案

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

<property name="lastBackSlash" value="${string::last-index-of(foldername, '\')}" />
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top