java calculate pathname difference [duplicate]
开发者_运维知识库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.
精彩评论