C# String Escape
Turn text into a C# verbatim string literal:@"..." with doubled quotes. The idiom for paths and regex.
What escaping a C# string does
The output is a verbatim string literal, @"...", in which a backslash means nothing and the only escape is a doubled quote. That is what a .NET developer pastes a Windows path or a regular expression into, because the alternative is a screen of doubled backslashes that nobody can read. Newlines are kept as themselves, which verbatim strings allow. If you need a regular literal instead, use the Java escape page and surround the result with quotes.
How to use it
C# String Escape: paste the text into the box above, and press Run to get the C# string literal below.
Worked example
Input:
C:\logs\app.exe
pattern: "\d+"
Output:
@"C:\logs\app.exe
pattern: ""\d+"""
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads text and returns C# string literal; reloading the page discards both.
The output is a verbatim string literal, @"...", in which a backslash means nothing and the only escape is a doubled quote. That is what a .NET developer pastes a Windows path or a regular expression into, because the alternative is a screen of doubled backslashes that nobody can read. Newlines are kept as themselves, which verbatim strings allow. If you need a regular literal instead, use the Java escape page and surround the result with quotes.
Turn text into a C# verbatim string literal:@"..." with doubled quotes. The idiom for paths and regex.
How to use it
C# String Escape: paste the text into the box above, and press Run to get the C# string literal below.
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads text and returns C# string literal; reloading the page discards both.
What to Expect
Best for
- Converting text to C# string literal when the data is already on screen.
What this tool keeps
- Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere.
Sample input
C:\logs\app.exe pattern: "\d+"
Sample output
@"C:\logs\app.exe pattern: ""\d+"""
Frequently asked questions
How do I use the c# string escape?
C# String Escape: paste the text into the box above, and press Run to get the C# string literal below.
Is my input uploaded?
No. The text is parsed on this page with JavaScript and is never posted to a server.
Is there a size limit?
Yes: 5 MB per run. Larger input is refused with a message rather than freezing the tab.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.