Convert newline characters \n into HTML line breaks <br />.
\n
<br />
Usage:
const ret1 = convertToHtmlBreaks('a\nb\nc');const ret2 = convertToHtmlBreaks('a\n\nbc');console.log(ret1);console.log(ret2); Copy
const ret1 = convertToHtmlBreaks('a\nb\nc');const ret2 = convertToHtmlBreaks('a\n\nbc');console.log(ret1);console.log(ret2);
Output:
a<br />b<br />c a<br /><br />bc Copy
a<br />b<br />c a<br /><br />bc
The string to make a new line.
A newline with br.
br
Convert newline characters
\n
into HTML line breaks<br />
.Usage:
Output: