Any quick way to extract base url from full url? for e.g., if i have http://test.example.com/abcd/test.html - i want only http://test.example.com.
I can always do strin
What about:
import java.net.URL; import java.net.MalformedURLException; try { URL url = new URL("http://test.example.com/abcd/test.html"); String baseUrl = url.getProtocol() + "://" + url.getHost(); } catch (MalformedURLException e) { // do something }