开发者

Convert textarea value to something suitable for span

I have data taken from a textarea an开发者_运维技巧d put into a database. It is then returned from the database, and I want to put it into a span tag with the formatting still intact. Is there a method that does this? I have tried

.Replace("\r\n", "<br />")

which fixes the line breaks, but that still leaves the whitespace and.. I am sure there has to be a built-in method somewhere.


Easiest solution is to mark your span as pre-formatted:

<span style="white-space:pre">text from textarea here</span>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜