[学习]自定义 class 的建立与使用

.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" Debug="true" %>
<%Response.Write(appclass_rplback("调出数据库字段"))%>

.vb

Imports appClass

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected 
Sub page_load(ByVal sender As Object, ByVal e As EventArgs)

    
End Sub
    
Function appclass_rplback(ByVal str As StringAs String

        
Dim myappClass As New appClass 
        Return myappClass.rplBack(str) 
    
End Function
End Class

App_Code 文件夹内的 appClass.vb 

Imports Microsoft.VisualBasic

Public Class appClass


    
'''---------------------  排 版     ----------------
    Function rpl(ByVal str As StringAs String

        str 
= Replace(str, "<""&lt;")
        str 
= Replace(str, ">""&gt;")
        str 
= Replace(str, Chr(13& Chr(10), "<br>")
        str 
= Replace(str, " ""&nbsp;")
        str 
= Replace(str, "'""&acute;")
        Return str
    
End Function
    
'------------------------ ROLLBACK 排版 ---------
    Function rplBack(ByVal str As StringAs String

        str 
= Replace(str, "&lt;""<")
        str 
= Replace(str, "&gt;"">")
        str 
= Replace(str, "<br>"Chr(13& Chr(10))
        str 
= Replace(str, "&nbsp;"" ")
        str 
= Replace(str, "&acute;""'")
        rplBack 
= str 

    
End Function
    
'------------------------ 去掉分号 ------
End Class


原文地址:https://www.cnblogs.com/apiapia/p/1160682.html