S
S
shark1366662018-02-06 14:27:54
C++ / C#
shark136666, 2018-02-06 14:27:54

How to escape quotes inside C# quotes?

Good afternoon, in the training course I came across a task for writing test cases. and i ran into a problem.
It remains to write two tests
1. Escaped single quotes inside single
2. Escaped double quotes inside double
But I can’t figure it out
Here is the condition
5a7990c42ea69455958132.png
Here is what I did
5a79910d7fc2e252893116.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
shark136666, 2018-02-07
@shark136666

Test("'\\\'a\\\''", new[]{"'a'"});
Test("\"\\\"a\\\"\"",new []{"\"a\""});
figured out

S
Stimulate, 2018-02-06
@Stimulate

Console.Write("\"Hello world!\"");
Console.Write('\'Hello world!\'');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question