gpt4 book ai didi

c# - 更改行终止符

转载 作者:太空宇宙 更新时间:2023-11-03 11:47:16 24 4
gpt4 key购买 nike

如何强制 StringReader.ReadLine()(或替代流)使用 \n 而不是 \r\n

最佳答案

来自 StringReader.ReadLine 上的 MSDN 文档:

A line is defined as a sequence of characters followed by a line feed ("\n"), a carriage return ("\r"), or a carriage return immediately followed by a line feed ("\r\n"). The resulting string does not contain the terminating carriage return and/or line feed. The returned value is null if the end of the underlying string has been reached.

因此,默认情况下,它将读取以 \n\r\r\n 结尾的行。您不需要覆盖任何内容。

关于c# - 更改行终止符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3100519/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com