有没有什么办法去code字符串? [英] is there any way to decode string?
问题描述
可能显示的文件:
我怎么能德code字符串?
<一href="http://stackoverflow.com/questions/994331/java-how-to-de$c$c-html-character-entities-in-java-like-httputility-htmlde$c$c">Java:如何去在Java中code HTML字符实体像HttpUtility.HtmlDe code?
Possible Duplicates:
How can I Decode string?
Java: How to decode HTML character entities in Java like HttpUtility.HtmlDecode?
您好,
我有串等作为例如&ampauml; S&amparing;需要转换像这样的ASA请帮我在这里
I have string like as an eg "&auml;s&aring;" that needs to be converted like this "äså" pls help me out here.
在此先感谢
推荐答案
有一个看的 StringEscapeUtils
在Apache共享库类。 (具体地<一href="http://commons.apache.org/lang/api-2.4/org/apache/commons/lang/StringEscapeUtils.html#unescapeHtml%28java.lang.String%29"相对=nofollow> unescapeHtml
法)。
Have a look at the StringEscapeUtils
class in the Apache Commons library. (Specifically the unescapeHtml
method).
import org.apache.commons.lang.StringEscapeUtils;
public class Test {
public static void main(String[] args) {
String str = "äså";
System.out.println(StringEscapeUtils.unescapeHtml(str)); // prints äså
}
}
这篇关于有没有什么办法去code字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!