JPC
JPC

Reputation: 8276

HTML parsing in Java

Basically if I have a string that looks like this:

%22Hello+World+%26+Hello+World%22

because I took it from HTML, how do I get Java to make this say Hello World & Hello World, aka replace the HTML pieces with text?

Thanks

Upvotes: 0

Views: 314

Answers (1)

Kirk Woll
Kirk Woll

Reputation: 77536

URLDecoder:

java.net.URLDecoder.decode("%22Hello+World+%26+Hello+World%22", "UTF-8")

Update: Modified to pass in the encoding as the second parameter.

Upvotes: 4

Related Questions