【Android开发】URL 转义与反转义

1,转义

 @org.junit.Test
    public void testEncode(){
        String url="http://192.168.0.19:8888/cas/login";
        String urlEncodee= URLEncoder.encode(url);
        System.out.println(urlEncodee);
    }

2,反转义

   @Test
    public void testDecode(){
        String url="http%3A%2F%2F192.168.0.19%3A8888%2Fcas%2Flogin";
        String urlDecode= URLDecoder.decode(url);
        System.out.println(urlDecode);
    }

posted @ 2019-03-07 17:36  浪里小白龙呼呼呼  阅读(4630)  评论(0编辑  收藏  举报