Remove carriage return from string

前端 未结 9 2122
逝去的感伤
逝去的感伤 2021-01-03 17:41

I would like to insert the following into a string

some text here

some text here

some text here

9条回答
  •  情歌与酒
    2021-01-03 18:18

    If you want to remove spaces at the beginning/end of a line too(common when shortening html) you can try:

    string.Join("",input.Split('\n','\r').Select(s=>s.Trim()))
    

    Else use the simple Replace Marc suggested.

提交回复
热议问题