C# 正则表达式替换换行
将换行替换成"\n"字符,如下:
代码一:
string strContent = txtNote.Text; strContent = Regex.Replace(strContent, "\r\n", "\\n");
代码二:
string strContent = txtNote.Text;
Regex regex = new Regex("\r\n"); strContent = regex.Replace(strContent, "\\n");
posted on 2013-11-28 17:52 AngelLee2009 阅读(1590) 评论(0) 编辑 收藏 举报