One of hundreds of answers available with our premium content service.
A: The URL getHost() method returns the fully qualified domain name (FQDN). To get the registered domain name you would need to break the FQDN further to remove any subdomains. The example below uses the String lastIndexOf() method to get the index of the dot separators and substring() to extract codestyle.org from www.codestyle.org.
… full answer hidden
Premium members click below for full answer
How do I get the registered domain name from a URL?