Is there a way, using java's standard library to replace characters like:

" with '"' and &# 39; (i put a space so the site doesn't change it) with ''' in a string?

For example, change from:

String message = ""This &# 39;is&# 39; a test&quote";

to:

message = "\"This \'is\' a test\"";

I'm not talking about using regular expressions or searching and replacing. I want it to cover all HTML characters. I think some text panes and things like that are able to do it. Anyone know which one and how I can use it's functions? Anyone other ideas?

Hmm... Why can't you use regex? What is the problem with it?

String str = "&quote;This is just something&# 39;";
str = str.replaceAll(/&quote;/, "\"");
 // or
str = str.replaceAll(/\&# 39;/, "\'"); // shouldn't have space as you said

And if you want it to cover all HTML code, you may implement a class that handle this for you. Each number, you will have to do the replacement individually.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.