JavaScript string with new line - but not using \n

前端 未结 8 2091
故里飘歌
故里飘歌 2020-11-27 05:44

I have a string that has new lines in. I am wanting to convert these to HTML
s, but I\'m having a hard time detecting them.

Imagine a JavaScri

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-27 05:55

    Check for \n or \r or \r\n.

    There are several representations of newlines, see http://en.wikipedia.org/wiki/Newline#Representations

提交回复
热议问题