ASP.NET里的字符替换一例

    技术2022-05-11  126

     

    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 StringstrTest = "A sentence with stuff to replace."no_replace.text = strTeststrTest = Regex.Replace(strTest, "to replace", "replaced")replace.text = strTestEnd Sub

    </script><html><body>原字符串: <asp:label id="no_replace" runat="server"/><hr />替换后字符串: <asp:label id="replace" runat="server"/></body></html>


    最新回复(0)