In Java, I want to compare two strings which are basically the urls, so if the endpoints are same and the domain is different it should return true. For example: https://www.example.org/dl/pi/1 should be a valid match with http://1.1.1.1/dl/pi/1
Compare path of url strings. Ignoring domain names
418 views Asked by Nikunj Aggarwal At
1
You could do something like this:
If the
URL
is not correct it'll throwMalformedURLException
.Javadoc can be found here | URL.