提交 0449001b 编写于 作者: K kohsuke

added a convenience method.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@23290 71c3de6d-444a-0410-be80-ed276b4c234a
上级 4f7d907a
......@@ -766,6 +766,17 @@ public final class FilePath implements Serializable {
});
}
/**
* Gets the file name portion except the extension.
*
* For example, "foo" for "foo.txt" and "foo.tar" for "foo.tar.gz".
*/
public String getBaseName() {
String n = getName();
int idx = n.lastIndexOf('.');
if (idx<0) return n;
return n.substring(0,idx);
}
/**
* Gets just the file name portion.
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册