2

where can i find this class StringEscapeUtils that can automatically escape the characters instead of manualy doing... on my search i found the util called StringEscapeUtils but i could not find in my project or i try to download from net but could not find too... is there a way i can make that automated something like this:

String testStr = "< > \" &"; 
System.out.println("Escaped : " + StringEscapeUtils.escapeHtml(testStr)); 
Nick Kahn
  • 19,652
  • 91
  • 275
  • 406

3 Answers3

5

You need to download the Apache Commons Lang library and include it in your project as a referenced library.

Bernard
  • 7,908
  • 2
  • 36
  • 33
1

org.apache.commons.lang.StringEscapeUtils is a part of the Apache Commons Lang package.

Eugene Retunsky
  • 13,009
  • 4
  • 52
  • 55
  • but what exactly i need to download, i am new to java – Nick Kahn Mar 28 '12 at 18:05
  • http://commons.apache.org/lang/download_lang.cgi - I recommend the most recent version (zip file) You'll need a jar file from the distribution. Add it to the project's classpath. – Eugene Retunsky Mar 28 '12 at 18:18
1

I think you're looking for: org.apache.commons.lang.StringEscapeUtils

See:

http://commons.apache.org/lang/

http://commons.apache.org/lang/api/org/apache/commons/lang3/StringEscapeUtils.html

http://commons.apache.org/lang/api/src-html/org/apache/commons/lang3/StringEscapeUtils.html

Danation
  • 743
  • 8
  • 20