使用java标准类库java.net.URL
java.net.URL url = new java.net.URL("http://blog.csdn.net/zhujianlin1990");
String host = url.getHost();// 获取主机名
System.out.println("host:"+host);// 结果 blog.csdn.net
Powered by: 博客园 Copyright © 2024 powerlx Powered by .NET 9.0 on Kubernetes