JuanesMesa
JuanesMesa

Reputation: 31

How to escape quotes in Java

I'm stuck with this:

I have a ResultSetto write in a html report. the ResultSetis

writer.write("<td><a href=>" + "../" + rsevidencia.getString("Evidencia") + 
             "<a/></td>");

But the link doesn't work because "Evidencia" is not into quotes, how to can I put quotes inside the ResultSet argument?

The ResultSet brings this 2013-10-10 09:15:00.110

Upvotes: 0

Views: 836

Answers (2)

X-Pippes
X-Pippes

Reputation: 1170

you can use "\"Evicendia\"". In java, you can access to escapate chars using \.

Upvotes: 1

rgettman
rgettman

Reputation: 178343

Escape a double-quote character in Java with a backslash character \: \" is one double-quote character.

//             Here's one -v                             Here's another -v
writer.write("<td><a href=\"../" + rsevidencia.getString("Evidencia") + "\">Label</a></td>");

This Java tutorial page, section "Escape Sequences" covers escape characters in Java.

Upvotes: 1

Related Questions