当前位置:编程学习 > asp >>

简单asp类模仿

现在才发现asp里面也可以自己写一些类,而且基本上和其他语言差不多,所以就自己写了一个试试,嘿嘿!纪年一下!
<%
Class clsDSJ
Private p_Error,p_Author,p_WebURL

Public Property Get Version
Version="DSJ 1.0.0 Beta"
End Property

Public Property Get Error
Error=p_Error
End Property

Public Property Get Author
Author=p_Author
End Property

Public Property Let Author(strAuthor)
strAuthor=Trim(strAuthor)
If strAuthor="" Then
p_Author="孤剑"
Else
p_Author=CStr(strAuthor)
End If
End Property

Public Property Get WebURL
WebURL=p_WebURL
End Property

Public Property Let WebURL(URL)
URL=Trim(URL)
If URL="" Then
p_WebURL="http://www.blog.csdn.net/alonesword/"
ELse
If LCase(CStr(Left(URL,7)))<>"http://" then
p_WebURL="http://" & URL
Else
p_WebURL=URL
End If
End If
End Property

Private Sub Class_Initialize
p_Author="孤剑"
WebURL="http://www.blog.csdn.net/alonesword/"
p_Error=-1


End Sub

Private Sub Class_Terminate

End Sub

Public Function gotTopic(str,strlen)
Rem 限制字符串显示长度在一定的范围内
Dim i,StringLen,CharSize,EchoCharType
StringLen=len(str)
CharSize=0
For i=1 to StringLen
EchoCharType=Abs(Asc(Mid(str,i,1)))
If EchoCharType>255 Then
CharSize=CharSize+2
Else
CharSize=CharSize+1
End If
If CharSize>strlen Then
gotTopic=Left(str,i) & "..."
Exit For
补充:asp教程,高级应用
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,