(快速)如何在字符串中打印“ \”字符?

我曾尝试打印它,但由于它是转义字符,因此只是通过而已。例如,输出应如下。

\correct

提前致谢

回答:

为此以及将来的参考:

\0 – Null character (that is a zero after the slash)

\\ – Backslash itself. Since the backslash is used to escape other characters, it needs a special escape to actually print itself.

\t – Horizontal tab

\n – Line Feed

\r – Carriage Return

\” – Double quote. Since the quotes denote a String literal, this is necessary if you actually want to print one.

\’ – Single Quote. Similar reason to above.

以上是 (快速)如何在字符串中打印“ \”字符? 的全部内容, 来源链接: utcz.com/qa/422949.html

回到顶部