简体   繁体   English

在不使用HTML的情况下对字符串中的换行符进行编码

[英]Encoding a line break in a string without using HTML

Is there a way to encode a line break into a string without using any HTML entities or tags? 有没有办法在不使用任何HTML实体或标签的情况下将换行符编码为字符串? Specifically, I would like a string that I pass into the dojox.gfx renderer to display a line break. 具体来说,我想要一个字符串,我传递到dojox.gfx渲染器以显示换行符。

You can escape it with \\n or \ , see: 您可以使用\\n\ 转义它,请参阅:

How do I break a string across more than one line of code in JavaScript? 如何在JavaScript中的多行代码中断字符串?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM