La copie de code est la suivante:
String statique publique Gethost (URL de chaîne) {
if (url == null || url.trim (). equals ("")) {
retour "";
}
String host = "";
Pattern p = motif.compile ("(? <= // |) ((// w) + //.) + // w +");
Matcher Matcher = P.Matcher (URL);
if (Matcher.Find ()) {
host = Matcher.Group ();
}
retour hôte;
}