/**
* get host of an url
* @param urlString
* @return
*/
public static String getHost(String urlString) {
int index = urlString.indexOf("://");
if (index != -1) {
urlString = urlString.substring(index + 3);
}
index = urlString.indexOf("/");
if (index != -1) {
urlString = urlString.substring(0, index);
}
return urlString;
}
给定一个url获取host
最新推荐文章于 2022-08-06 00:00:00 发布