String with double quotes includes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

string code = "05"
string str

I want the string str as follows = "05" in that case the double quotes makes part of the sting

I tried as follows
str= "\"" + code + "\""

I receive following (when I stand on str) --> "\"05\"

I tried also
str = @"""" + code + @""""

I receive following (when I stand on str) --> "\"05\"

How I can slove this
Thx
Ja
 
what you have looks good, so i tried it out on my pc, and it worked fine

both of the bellow will result in a string of "05
1. code = "\"05\""
o
2. code = "05"; str = "\"" + code + "\""

--Da

----- Jac wrote: ----

Hi

string code = "05"
string str

I want the string str as follows = "05" in that case the double quotes makes part of the sting

I tried as follows
str= "\"" + code + "\""

I receive following (when I stand on str) --> "\"05\"


I tried also
str = @"""" + code + @""""

I receive following (when I stand on str) --> "\"05\"

How I can slove this
Thx
Ja
 
string code = "05";
string str;

I want the string str as follows = "05" in that case the double quotes makes part of the sting.

I tried as follows :
str= "\"" + code + "\"";

I receive following (when I stand on str) --> "\"05\""

I am not sure what you are looking at when you "stand on str" but it seems
okay to me, the debugger may give you the wrong yet accurate impression. If
you would print the string you would see "05" just as you intend it to be.

Martin.
 
Visual Studio.NET will display the escape sequence for characters that
require them in order to include them in strings, in many of its
debugger-related windows and tooltips. This might be confusing you. Quote
marks are one of those characters.

If you print out the values, you should see the strings you are expecting.

Hope this helps.
 
Back
Top