s.Replace(" ", " ");
s.Replace("\r", "<br>");
s.Replace("", "/>");
不知道是不是这个意思。
s.Replace("\r", "<br>");
s.Replace("", "/>");
不知道是不是这个意思。
解决方案 »
- c# oracle【us7ascii】 sys.xmltype字段 中文乱码该如何解决
- WinForm的怪异问题,困扰好几天了,大家帮忙看看--在线等(分可以再加)...
- 六百里加急,跪求一正则表达式写法(C#.net环境)
- 调整窗体大小时候的方法
- 急!导出到Excel中为什么都在同一列里面了?!
- WebForm的datagrid的问题
- 想知道某个表中的那些字段是关键字的SQL语句怎么写
- 关于站内短消息的操作问题
- 旧题新问:(要求内详)2005中,如何实现当前程序的XP样式而不影响系统样式,并且是直接对样式文件操作,谢谢。。。?
- 咨询C#编译器的下载
- Socket和数据库
- ASPX没有写映射文件夹的权限,怎么办???
可是不能出现 <br>等
我原来是用asp的.
是这样的
s= replace(s, ">", ">")
s= replace(s, "<", "<")
s= Replace(s, CHR(32)," ")
s= Replace(s, CHR(13),"")
s= Replace(s, CHR(10) & CHR(10),"</P><P>")
s= s(fString, CHR(10),"<BR>")
re.Pattern="\[IMG](.[^\[]*)\[\/IMG]"
strContent=re.Replace(strContent,"<IMG SRC=""$1"" border=0>")
re.Pattern = "\[b](.[^\[]*)\[\/b]"
strContent = re.Replace(strContent,"<b>$1</b>")
re.Pattern = "\[FLASH](.[^\[]*)\[\/FLASH]"
strContent = re.Replace(strContent,"<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=500 height=400><PARAM NAME=movie VALUE=""$1""><PARAM NAME=quality VALUE=high><embed src=""$1"" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=500 height=400>$1</embed></OBJECT>")
高手解决.谢谢谢谢.
using System.Text.RegularExpressions;class test
{
public static void Main ()
{
Regex re = new Regex("\\
String strContent = "[img]http://wwww.test.com/test.jpg" alt="" />";
strContent=re.Replace(strContent,"<IMG SRC=\"$1\" border=0>");
Console.WriteLine(strContent);
}
}这段代码出来的结果是<IMG SRC="http://wwww.test.com/test.jpg" border=0>
不知有没有帮助。
{
string temp="";
temp = content.Replace(" "," ");
temp = temp.Replace( Convert.ToString( ( char ) 13 ),"<br>");
temp = temp.Replace( Convert.ToString( ( char ) 10 )," ");
return temp;
}
上面的在关空格和回车符的转换,试试!
s.replace("<", "<");
s.Replace(" "," ");
s.Replace("\n","");
s.Replace("\n\r","</P><P>");
s.Replace("\r","<BR>");
s= System.Text.RegularExpressions.Regex.Replace(s,@"\s", " ");
回车的总是测试中.
谢谢你公主.
一会给你加分.
Regex re = new Regex("\\
String strContent = "[img]http://wwww.test.com/test.jpg" alt="" />";
strContent=re.Replace(strContent,"<IMG SRC=\"$1\" border=0>");
String strContent = "<img src=/>\r \r\rtest\r \r";
strContent=Regex.Replace(strContent,"(\r){2}", "<p>");
strContent=Regex.Replace(strContent,"\r", "<br>");
Console.WriteLine(strContent);输出是<img src=/><br> <p>test<br> <br>
不知可不可以。
Regex re = new Regex("\\
String strContent = "[IMg]http://wwww.test.com/test.jpg" alt="" />";
strContent=re.Replace(strContent,"<IMG SRC=\"$1\" border=0>");
然后把里面输入文字再加回车.
然后写语句把它的回车换成<br>.我试了一上午了.头大.脚软. :)
谢谢你噢.
<%@ Page Language="C#" Debug="true" %>
<%@ import namespace="System.Text.RegularExpressions" %>
<HTML>
<script runat="server">
public void btnclick(Object sender, EventArgs e) {
String str = txt.Text;
str=Regex.Replace(str,"(\r){2}", "<p>");
str=Regex.Replace(str,"\r", "<br>");
Response.Write(str);
}
</script>
<HEAD>
</HEAD>
<body id="bd1" runat="server">
<form id="f1" Target="_top" runat="server">
<asp:TextBox id="txt" runat="server" textmode=MultiLine/>
<asp:button id="btn" runat="server" onclick="btnclick" text="convert"/>
</form>
</body>
</HTML>