Escape sequence with “\” symbol

前端 未结 4 1491
遥遥无期
遥遥无期 2021-01-07 03:49

i have one string, and i assign the value like,

string str=\"admin\" + @\"\\\" + \"user\";

The output of the \"str\" value comes as

4条回答
  •  没有蜡笔的小新
    2021-01-07 04:26

    The output of the "str" value comes as "admin\\user"

    No, it really doesn't. The string itself will just have a single backslash.

    If you look at it in the debugger you will see the escaping, but that doesn't mean it's part of the string. It's just the debugger representation. Print it to the console, or log etc to see the real value.

提交回复
热议问题