CSDN博客

img net_lover

ASP.NET里的字符替换一例

发表于2001/4/24 15:09:00  2571人阅读

分类: ASP.NET

 

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>
</html>

0 0

相关博文

我的热门文章

img
取 消
img