Removing line breaks using C#

前端 未结 5 1976
时光取名叫无心
时光取名叫无心 2021-02-20 03:55

I am getting a string from database field named \'Description\' and it has line breaks. It looks like this:


Header of Items

Description goes here.This the

5条回答
  •  北海茫月
    2021-02-20 04:48

    Have you tried using regular expressions? They are pretty good in handling these type of tasks

    result = Regex.Replace(result, @"\r\n?|\n", " ");
    

提交回复
热议问题