I know both NetBeans and Eclipse has options where if you paste multi-line, un-escaped string into a string variable, it will automatically add escape characters and add line breaks in. Is there a way to reverse the process?
For example:
function ShowHideOptions(trigger, element) {
if( trigger ) {
document.getElementById( element ).style.display = "";
} else {
document.getElementById( element ).style.display = "none";
}
}
if pasted in to string becomes:
private static final String LABEL_JAVASCRIPT = "function ShowHideOptions(trigger, element) {\n"
+ " if( trigger ) {\n"
+ " document.getElementById( element ).style.display = \"\";\n"
+ " } else {\n"
+ " document.getElementById( element ).style.display = \"none\";\n"
+ " }\n"
+ "}";
I want reverse this process.
I believe your question warrants another question. Why?
If you reverse this, the quotes would not be escaped and therefore you would get errors. Example:
Notice the quotes aren’t escaped. This code would generate an error where I marked it because the quotes apparently mean the string should end.
Also, if the newlines are reversed, this example:
Would become:
The following code works fine. Please clarify the problem.