GroganJ
asked on
Inserting a control character into a string
Hi,
I have 2 strings and I want to put the character "\" between them.
So, I have
string a = "MMM";
string b = "I01";
string c = a+"\"+b;
so c looks like "MMM\I01".
However, no matter how I structure the addition, the single \ is always replaced with a \\.
Any thoughts how to achieve this?
John.
I have 2 strings and I want to put the character "\" between them.
So, I have
string a = "MMM";
string b = "I01";
string c = a+"\"+b;
so c looks like "MMM\I01".
However, no matter how I structure the addition, the single \ is always replaced with a \\.
Any thoughts how to achieve this?
John.
string c= string.Format(@"{0}\{1}", a, b);
this must work
this must work
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Guys - the problem was that VS was showing double. When it passed the string to the end application, it worked just fine.
Open in new window