import java.io.UnsupportedEncodingException;
/**
* url转码、解码
*/
public class UrlUtil {

private final static String ENCODE = "UTF-8";
/** URL 解码*/
public static String getURLDecoderString(String str) {
String result = "";
if (null == str) {
return "";
}
try {
result = java.net.URLDecoder.decode(str, ENCODE);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return result;
}

/** URL 转码*/
public static String getURLEncoderString(String str) {
String result = "";
if (null == str) {
return "";
}
try {
result = java.net.URLEncoder.encode(str, ENCODE);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return result;
}

}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-18
  • 2022-01-10
  • 2021-11-03
  • 2021-12-02
  • 2021-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-31
  • 2022-01-01
  • 2021-09-06
  • 2022-02-14
  • 2021-09-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案