标签:
1.编码字符串
public static String encode(String s, String encodeType) { if (s == null || s.equals("")) { return ""; } if (encodeType == null || encodeType.equals("")) { return s; } try { return URLEncoder.encode(s, encodeType); } catch (Exception e) { } return s; }
2.解码字符串
public static String decode(String s, String encodeType) { if (s == null || s.equals("")) { return ""; } if (encodeType == null || encodeType.equals("")) { return s; } try { s = URLDecoder.decode(s, encodeType); } catch (Exception e) { } return s; }
标签:
原文地址:http://www.cnblogs.com/chenchaochao/p/5527292.html