Click here to Skip to main content
15,890,399 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to convert the string: transport service "abc" to transport service \"abc\" in c#, what command should I use? thank you!

What I have tried:

I want to convert the string: transport service "abc" to transport service \"abc\" in c#, what command should I use? thank you!
Posted
Updated 13-Apr-22 2:44am

1 solution

I'm pretty sure you don't actually need to, but ...
C#
string inp = "transport service \"abc\"";
string outp = inp.Replace("\"", "\\\"");
Console.WriteLine (inp);
Console.WriteLine (outp);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900