日期:2014-05-18 浏览次数:20437 次
public class TxtOperational { public static string FormatText(string text) { string formatted = ""; StringBuilder sb = new StringBuilder(text); sb.Replace(" "," "); StringReader sr = new StringReader(sb.ToString()); StringWriter sw = new StringWriter(); while (sr.Peek() > -1) { string temp = sr.ReadLine(); sw.Write(temp + "<br />"); } formatted = sw.GetStringBuilder().ToString(); return formatted; } }
------解决方案--------------------
上面的方法就是实现
在文本框中这样输入:
(我 来
了...)
在页面上会这样显示:
(我 来
了...)
------解决方案--------------------
同意楼上的!