Why does Console.WriteLine() function miss some characters within a string?

后端 未结 7 2362
野的像风
野的像风 2021-02-12 10:42

I have a string, declared as:

 string text = \"THIS IS LINE ONE \"+(Char)(13)+\" this is line 2\";

And yet, When I write Console.WriteLin

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-12 11:43

    (char)13 is a carriage return (To the left margin on the current line)

    THIS IS LINE ONE \r this is line 2"
    

    Is interpreted as:

    Print THIS IS LINE ONE
    then *return* and print this is line 2
    The overlap is: E
    So you see: this is line 2E

提交回复
热议问题