String hostIP = "http://www.baidu.com/s/t"; hostIP = hostIP.replace("http://","").replace("https://",""); // Remove http and https prefix String [] arr = hostIP.split("/") ; // Separate by '/', take the first hostIP = arr[0];
String hostIP = "http://www.baidu.com/s/t"; hostIP = hostIP.replace("http://","").replace("https://",""); // Remove http and https prefix String [] arr = hostIP.split("/") ; // Separate by '/', take the first hostIP = arr[0];