I’m trying to save a String to a database, I need the quotes to be part of the string:
String password = "\"foo\"";
I am expecting the value in the database to be "foo" (quotes included)
However the slash is also stored. Should the slash be just a escape character and not be saved when compiled?
Not in the string you’ve posted it isn’t. The string you’ve posted has five characters in it:
It may be that whatever you’re using to view it is showing the quotes escaped so that it’s clear that they’re not delimiting the string.
You can prove this like so:
Output: