开发者

Problem with string format

开发者 https://www.devze.com 2023-03-31 12:38 出处:网络
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 assi

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

0

精彩评论

暂无评论...
验证码 换一张
取 消