-2

I have string 'a\\\' b', i need make algorithm which will convert this string to string 'a' b'

  1. 'a\\\' b' = > 'a\\' b' => 'a\' b' = > 'a' b' How i can make it? Maybe c# have a method which can check , is char contains verbatim symbol or not?
gunr2171
  • 16,104
  • 25
  • 61
  • 88
  • Also see [How do I write a backslash (\) in a string?](https://stackoverflow.com/questions/18532691/how-do-i-write-a-backslash-in-a-string) – gunr2171 Apr 19 '21 at 15:14
  • Or, even better [Remove '\' char from string c#](https://stackoverflow.com/questions/8383409/remove-char-from-string-c-sharp) – gunr2171 Apr 19 '21 at 15:15
  • Post code that shows your problem. People are constantly confusing string values, string literals, and escaped strings. We don't know which you have. – Dour High Arch Apr 19 '21 at 15:28

1 Answers1

0

You could just replace the backslashes with an empty string.

string example = "'a\\\' b'";

Console.WriteLine(example.Replace("\\", string.Empty)); // Prints 'a' b'

mamen
  • 1,202
  • 6
  • 26