URL介绍及处理

    xiaoxiao2025-12-25  7

    URL组成:

    protocol://host:port/path?query

    从URL中拿到host:

    public static String getHostFromURL(String url){ if(url==null) return null; //remove 'http(s)://' int index=url.indexOf("//"); if(index>=0) url=url.substring(index+"//".length()); //remove path of URL index=url.indexOf("/"); if(index>=0) url=url.substring(0,index); return url; } 相关资源:python入门教程(PDF版)
    最新回复(0)