Android URL Encode encode(String base)

Here you can find the source of encode(String base)

Description

encode

Declaration

public static String encode(String base) 

Method Source Code

//package com.java2s;
import android.net.Uri;

public class Main {
    public static String encode(String base) {
        String encoded = Uri.encode(base);
        return encodeURI(encoded);
    }//from w  ww .j  a v  a2 s.  c  om

    public static String encodeURI(String encoded) {
        encoded = encoded.replace("(", "%28");
        encoded = encoded.replace(")", "%29");
        encoded = encoded.replace("!", "%21");
        encoded = encoded.replace("\'", "%27");
        encoded = encoded.replace("*", "%2A");
        return encoded;
    }
}

Related

  1. encode(String value)
  2. encodeURI(String encoded)
  3. encode(String url)
  4. urlEncode(String url)
  5. encodeURL(String value)
  6. urlEncode(String string)