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>

你可能感兴趣的:(server,object,String,asp.net,asp,import)