Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java get domain from url

public static String getDomainName(String url) throws URISyntaxException {
    URI uri = new URI(url);
    String domain = uri.getHost();
    return domain.startsWith("www.") ? domain.substring(4) : domain;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #domain #url
ADD COMMENT
Topic
Name
9+8 =