Fastest way to remove chars from string

前端 未结 7 1696
生来不讨喜
生来不讨喜 2020-12-05 13:52

I have a string from which I have to remove following char: \'\\r\', \'\\n\', and \'\\t\'. I have tried three different ways of removing these char and benchmarked them so I

7条回答
  •  执念已碎
    2020-12-05 14:46

    string str;
    str = str.Replace(Environment.NewLine, string.Empty).Replace("\t", string.Empty);
    

提交回复
热议问题