Home > DeveloperSection > Forums > Writing “\\” inside a string
Babe Zaharias
Babe Zaharias

Total Post:19

Posted on    July-08-2013 8:16 AM

 C# C# 

 1 Reply(s)
 1064  View(s)
Rate this:
Hi Developers!

I want to do something like:

string s = "\\blabla";

when you write "\" it means there will only be a single '\'. How do I write the string so there will actually be 2 '\' meaning "\" ?


Total Post:604

Posted on    July-08-2013 8:27 AM

Hi Babe!

This works without a problem:

string s = "//blabla";
If you mean the backslash instead, you can use a verbatim string literal (using the @ symbol to avoid processing escape symbols):

string s = @"\\blabla";
Alternatively you can escape the escape character itself:

string s = "\\\\blabla";

Don't want to miss updates? Please click the below button!

Follow MindStick