最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Creating Line Breaks in Dart - Stack Overflow

programmeradmin5浏览0评论

I need to get make a break inside a string that will output in HTML;

String str = "Hello <br /> There"; 

would output:

Hello 
There

I need to get make a break inside a string that will output in HTML;

String str = "Hello <br /> There"; 

would output:

Hello 
There
Share Improve this question edited Apr 20, 2019 at 19:49 Suragch 512k338 gold badges1.4k silver badges1.4k bronze badges asked Sep 3, 2014 at 18:42 LucaSpeedStackLucaSpeedStack 5112 gold badges7 silver badges22 bronze badges 6
  • Hi, can you be more specific? What have you tried and what didn't work? – Seth Ladd Commented Sep 3, 2014 at 19:48
  • @SethLadd I have tried everything. All I want is to make a String with a break, then put it into an HTML element, such as a div, and make the text appear on more than 1 line. – LucaSpeedStack Commented Sep 3, 2014 at 19:52
  • You haven't shown what you tried and what the error was. That will really help us answer your question. – Seth Ladd Commented Sep 3, 2014 at 19:53
  • @SethLadd With the above example in my question: no errors e up but only <br /> appears. – LucaSpeedStack Commented Sep 3, 2014 at 19:54
  • @SethLadd I don't know what else to try.. – LucaSpeedStack Commented Sep 3, 2014 at 19:56
 |  Show 1 more ment

1 Answer 1

Reset to default 12

Try

String str = "Hello\nThere";

instead.

Might need to apply white-space: pre or white-space: pre-wrap to the style of the element where you're displaying the text, though.

发布评论

评论列表(0)

  1. 暂无评论