How to eliminate ALL line breaks in string?

后端 未结 12 2119
傲寒
傲寒 2021-01-30 10:22

I have a need to get rid of all line breaks that appear in my strings (coming from db). I do it using code below:

value.Replace(\"\\r\\n\", \"\").Replace(\"\\n\"         


        
12条回答
  •  清歌不尽
    2021-01-30 11:15

    According to wikipedia, there are numerous line terminators you may need to handle (including this one you mention).

    LF: Line Feed, U+000A
    VT: Vertical Tab, U+000B
    FF: Form Feed, U+000C
    CR: Carriage Return, U+000D
    CR+LF: CR (U+000D) followed by LF (U+000A)
    NEL: Next Line, U+0085
    LS: Line Separator, U+2028
    PS: Paragraph Separator, U+2029

提交回复
热议问题