Problem with string format
I would like to assign string "{"MY_URL", "MY"}" to string variable. So in my code behind (C#)
I wrote like string str ="{\"MY_URL\", \"MY\"}"
. Whe开发者_StackOverflow社区n i will assign this to textbox it will print escape character ("\") as well. That i don't want so what i have to do to achieve this??
When i will assign this to textbox it will print escape character ("\") as well.
It shouldn't, and it doesn't on my side, at least on a vanilla VS 2008 ASP.Net application. Perhaps you have explained this question wrong?
I have just tested this on my end, and it is working as expected.
string str = "{\"PCT51_URL\", \"MY\"}";
TextBox1.Text = str;// this is working fine to me.
But if it is still not working for you, you can replace those. e.g.
TextBox1.Text = str.Replace("\\","");
Note: I am using VS2010
精彩评论