0

my problem is that I have a string called url which has an extructure like the following https://www.ejemplo.com.co, and I need to extract only the text after "https: // www.", that is what I serves is "ejemplo.com.co", of course I do not know the url as it changes constantly.

1 Answers1

0

Use the following:

    public String retrieveStr(String url) throws MalformedURLException {
       URL aURL = new URL(url);
       String desireStr  = aURL.getHost().split("\\.")[1];
      return desireStr;
  }

use this

Mamun Kayum
  • 161
  • 7