How to remove new line characters from a string?

后端 未结 11 976
时光取名叫无心
时光取名叫无心 2020-11-27 10:32

I have a string in the following format

string s = \"This is a Test String.\\n   This is a next line.\\t This is a tab.\\n\'

I want to remo

11条回答
  •  醉话见心
    2020-11-27 11:03

    You can use Trim if you want to remove from start and end.

    string stringWithoutNewLine = "\n\nHello\n\n".Trim();
    

提交回复
热议问题