我有一个字符串,声明为:
string text = "THIS IS LINE ONE "+(Char)(13)+" this is line 2";
然而,当我编写 Console.WriteLine(text);
时,
输出是:
this is line 2E
为什么会发生这种行为?还是因为我太蠢而遗漏了一些明显的东西?
为什么不打印:
THIS IS LINE ONE [CR] //where the CR is a non printed character
this is line 2
编辑
请注意:这不是“我如何添加回车符”问题。
最佳答案
(char)13
是回车回车(到当前行的左边距)
THIS IS LINE ONE \r this is line 2"
被解释为:
打印这是第一行
然后 *return* 并打印这是第 2 行
重叠部分是:E
所以你看:这是第 2E 行
关于c# - 为什么 Console.WriteLine() 函数会遗漏字符串中的某些字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27192074/