Having issue appending double quote inline into string builder
Having an issue replacing a pipe 开发者_运维技巧with a double quote in a stringbuilder.
sbSql.Append("|" + State + "|");
string strSql = sbSql.ToString().Replace("|", "\"");
Code above yields \"KS\" where I need it to be "KS" or whatever value is in State.
Ideas?
No, it doesn't. You only think that there are backslashes in front of the quotation marks because you are looking at the value in the debugger, which shows the string as you would write it as a string literal.
If you are seeing \"KS\"
in a debug window, you have "KS"
in strSql (unless I am mistaken in how I am reading your question.)
精彩评论