Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java string inside string to string

Tags:

java

string

I have this string: "\"Blah \'Blah\' Blah\"". There is another string inside it. How do I convert that into: Blah 'Blah' Blah? (you see, unescaping the string.) This is because I get a SQL Where query:

WHERE blah="Blah \'Blah\' Blah"

When I parse this, I get the string above (still inside quotes and escaped.) How would I extract that, un-escaping the string? Or is ther some much easier way to do this? Thanks,
Isaac

like image 723
Isaac Waller Avatar asked Jul 13 '26 15:07

Isaac Waller


1 Answers

DO NOT DO THIS.

Follow the proper steps for parametrization of a query on your Database/Platform, and you won't have to escape anything. You also will protect yourself from injection vulnerabilities.

like image 146
FlySwat Avatar answered Jul 16 '26 05:07

FlySwat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!