新微赢技术网

标题: ASP.NET里的字符替换一例 [打印本页]

作者: 「①冄12號    时间: 2009-3-16 20:33
标题: ASP.NET里的字符替换一例
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Text.RegularExpressions" %>

<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
Dim strTest As String
strTest = "A sentence with stuff to replace."
no_replace.text = strTest
strTest = Regex.Replace(strTest, "to replace", "replaced")
replace.text = strTest
End Sub
</script>
<html>
<body>
原字符串: <asp:label id="no_replace" runat="server"/>
<hr />
替换后字符串: <asp:label id="replace" runat="server"/>
</body>




欢迎光临 新微赢技术网 (http://bbs.weiying.cn/) Powered by Discuz! X3.2