public class UrlUtil {
private final static String ENCODE = "UTF-8";
/**
* URL 解码
*
* @return String
* @author lifq
*/
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 转码
*
* @return String
* @author lifq
*/
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;
}
}
URL转码与解码
最新推荐文章于 2020-03-09 11:31:22 发布
本文介绍了一种使用Java实现的URL编码与解码的方法。通过具体的代码示例,展示了如何进行URL的编码与解码操作,这对于网络请求中处理特殊字符十分有用。
部署运行你感兴趣的模型镜像
您可能感兴趣的与本文相关的镜像
Seed-Coder-8B-Base
文本生成
Seed-Coder
Seed-Coder是一个功能强大、透明、参数高效的 8B 级开源代码模型系列,包括基础变体、指导变体和推理变体,由字节团队开源
724

被折叠的 条评论
为什么被折叠?



