nant:我可以提取路径中的最后一个目录吗?

Ben*_*oit 1 nant

在 Nant 中,我希望能够提取路径中目录的姓氏。
例如,我们有路径 'c:\my_proj\source\test.my_dll\'

我想传入该路径并提取“test.my_dll”

有没有办法轻松做到这一点?

yor*_*oto 5

您实际上可以使用现有的 NAnt 字符串函数来完成。就是有点丑。。。

${string::substring(path, string::last-index-of(path, '\') + 1, string::get-length(path) - string::last-index-of(path, '\') - 1)}
Run Code Online (Sandbox Code Playgroud)