java - Escaping quotes -
i'm trying save string database, need quotes part of string:
string password = "\"foo\"";
i expecting value in database "foo"
(quotes included) slash stored. should slash escape character , not saved when compiled?
however slash stored.
not in string you've posted isn't. string you've posted has 5 characters in it:
" f o o "
it may whatever you're using view showing quotes escaped it's clear they're not delimiting string.
you can prove so:
public class showstring { public static final void main(string[] args) { string password = "\"foo\""; int index, len; (index = 0, len = password.length(); index < len; ++index) { system.out.println("[" + index + "]: " + password.charat(index)); } } }
output:
[0]: " [1]: f [2]: o [3]: o [4]: "
Comments
Post a Comment