Text format conversion (Text and Html)

ExpandedBlockStart.gif Code
     public   string  writeStr( string  oldStr)
    {
        
// oldStr=oldStr.Replace("''","'");   
        oldStr  =  oldStr.Replace( "     " "   " );
        oldStr 
=  oldStr.Replace( " &lt; " " < " );
        oldStr 
=  oldStr.Replace( " &gt; " " > " );
        oldStr 
=  oldStr.Replace( " <br/> " " \n " );
        oldStr 
=  oldStr.Replace( " &nbsp;&nbsp;&nbsp; " " \t " );
        oldStr 
=  oldStr.Replace( " &quot; " " \ "" );
         return  oldStr;
    }
    
public   string  readStr( string  oldStr)
    {
        
// oldStr=oldStr.Replace("'","''");   
        oldStr  =  oldStr.Replace( " &nbsp; " "     " );
        oldStr 
=  oldStr.Replace( " < " " &lt; " );
        oldStr 
=  oldStr.Replace( " > " " &gt; " );
        oldStr 
=  oldStr.Replace( " \n " " <br/> " );
        oldStr 
=  oldStr.Replace( " \t " " &nbsp;&nbsp;&nbsp; " );
        oldStr 
=  oldStr.Replace( " \ "" " & quot; " );
         return  oldStr;
    }

 At the time of filing the articles newline Convert.ToString ((char) 13) + Convert.ToString ((char) 10) replacing the HTML code </ P>, what is <BR>

Reproduced in: https: //www.cnblogs.com/qiangshu/archive/2010/05/07/1729422.html

Guess you like

Origin blog.csdn.net/weixin_33736048/article/details/94688212