如何在 C# 中替换字符串中的换行符?
最佳答案
使用 Environment.NewLine
替换
myString = myString.Replace(System.Environment.NewLine, "replacement text"); //add a line terminating ;
如其他帖子中所述,如果字符串来自另一个环境 (OS),那么您需要替换 new line control characters 的特定环境实现.
关于c# - 替换字符串 C# 中的换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/238002/