📜  java 从 url 获取域 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:20.039000             🧑  作者: Mango

代码示例1
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;
}