开发者

java calculate pathname difference [duplicate]

This question already has answers here: How to construct a relative path in Java from two absolute paths (or URLs)? (23 answers) Closed 6 years ago.

开发者_运维知识库Is there an open source library that, given ...

/a/b/c
/a/b/c/d/e

would return ../..

or for that matter given

/a/b/c/d
/a/b/c/e

would return ../d

?


If you don't mind passing by converting your Strings into URI then this latter one has the method relativize which should do exactly what you want, take a look here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜