Simple ASP class Imitation

Source: Internet
Author: User
Tags strlen trim
Only now found that the ASP can also write some of their own classes, and basically similar to other languages, so they wrote a try, hey! The Annals!
<%
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= "Lone Sword"
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.111cn.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= "Lone Sword"
Weburl= "http://www.blog.111cn.net/alonesword/"
P_error=-1


End Sub

Private Sub Class_Terminate

End Sub

Public Function gottopic (Str,strlen)
Rem Limit string display length within a certain range
Dim I,stringlen,charsize,echochartype
Stringlen=len (str)
Charsize=0
For I=1 to Stringlen
Echochartype=abs (ASC (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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.