关于TextArea换行符 [英] Regarding TextArea line break

查看:120
本文介绍了关于TextArea换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个textArea,用户在那里输入一条消息。我想将消息保存在数据库中,但在以后显示消息时保留格式。我目前正在将消息存储为varchar(1000),但没有保留任何格式化换行符。有关如何执行此操作的任何想法?

Lets say I have a textArea and a user types a message in there. I want to save the message in the database but preserve formatting when the message is displayed at a later time. I'm currently storing the message as an varchar(1000) but none of the formatting line breaks get preserved. Any ideas on how to do this?

推荐答案

您没有提供任何有用的信息来帮助您解决问题。所以,我只能给你一些想法。



经过一番思考后,我可以建议你在文本区域实际上没有任何换行符。看起来像你的换行符可能只是文字的自动换行。你看到的单独线条实际上就数据来说只是同一行/段落的一部分。



要了解换行如何工作,请参阅: http://en.wikipedia.org/wiki/End_of_line [ ^ ]。



注意结束不幸的是,-line字符串依赖于系统。



-SA
You did not provide any useful information helping to resolve your problem. So, I can only give you a couple ideas.

After some thinking, I can to suggestion that in your text area you actually never had any line breaks. What seemed as line breaks for you could be just word wrapping of the text. The lines you saw as separate lines were actually, in terms of data, just parts of the same single line/paragraph.

To understand how line break works, please see: http://en.wikipedia.org/wiki/End_of_line[^].

Pay attention that the end-of-line string, is, unfortunately, system-dependent.

—SA


这篇关于关于TextArea换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆