怎么样才能把数据库里的txt或者是word形式的文章取出与网页链接?

发布网友 发布时间:2024-10-24 12:53

我来回答

1个回答

热心网友 时间:6分钟前

提供一点思路:
定义两个函数完成进行文字格式转换:
public string writeStr(string oldStr)
{
//oldStr=oldStr.Replace( " ' ' ", " ' ");
oldStr=oldStr.Replace( " ", " ");
oldStr=oldStr.Replace( "< ", " < ");
oldStr=oldStr.Replace( "> ", "> ");
oldStr=oldStr.Replace( " <br/> ", "\n ");
oldStr=oldStr.Replace( " ", "\t ");
oldStr=oldStr.Replace( "" ", "\ " ");
return oldStr;
}

public string readStr(string oldStr)
{
//oldStr=oldStr.Replace( " ' ", " ' ' ");
oldStr=oldStr.Replace( " ", " ");
oldStr=oldStr.Replace( " < ", "< ");
oldStr=oldStr.Replace( "> ", "> ");
oldStr=oldStr.Replace( "\n ", " <br/> ");
oldStr=oldStr.Replace( "\t ", " ");
oldStr=oldStr.Replace( "\ " ", "" ");
return oldStr;
}
在提交文章的时候把换行符Convert.ToString((char)13) + Convert.ToString((char)10)替换成HTML代码 </P> 、 <BR> 什么的

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com