Detection function ASP Class_asp class classes

Source: Internet
Author: User
Copy Code code as follows:

<%
Dim CMD
Set CMD = New Cls_command
Class Cls_command
Private Re

Public Function Ispositiveinteger (value)
Set Re = New RegExp
Re.pattern = "^[1-9][\d]*$"
Re.ignorecase = True
Re.global = True
Ispositiveinteger = re.test (value)
Set Re = Nothing
End Function

Public Function isdigit (vstring)
If vstring = "" Then isdigit = False:exit Function
Set Re = New RegExp
Re.pattern = "^[a-z]+$"
Re.global = True
Re.ignorecase = True
Re.multiline = True
IsDigit = Re.test (vstring)
Set Re = Nothing
End Function

Public Function Isalpha (vstring)
If vstring = "" Then isalpha = False:exit Function
Set Re = New RegExp
Re.pattern = "^[\d]+$"
Re.global = True
Re.ignorecase = True
Re.multiline = True
Isalpha = Re.test (vstring)
Set Re = Nothing
End Function

Public Function isalphadigit (vstring)
If vstring = "" Then isalphadigit = False:exit Function
Set Re = New RegExp
Re.pattern = "^[a-za-z\d]+$"
Re.global = True
Re.ignorecase = True
Re.multiline = True
Isalphadigit = Re.test (vstring)
Set Re = Nothing
End Function

Dim Templatecontent,templatedebug
Public Sub loadtemplate (templatename)
On Error Resume Next
Dim Templateobject,templatefile
Set templateobject=server.createobject ("Scripting.FileSystemObject")
Set Templatefile=templateobject.opentextfile (Server.MapPath (templatename))
If err.number <> 0 Then
Err.Clear
Set templatefile=nothing
Set templateobject=nothing
Templatedebug=1
End If
Templatecontent=templatefile.readall
Templatefile.close
Set templatefile=nothing
Set templateobject=nothing
End Sub

Dim Htmlcontent,creatdebug
Public Sub buildfile (catalogue, HTMLName)
On Error Resume Next
If not Checkfolder (catalogue) Then
Creatdebug=1
Exit Sub
End If
Dim Creatobject,creatfile
Set creatobject=server.createobject ("Scripting.FileSystemObject")
Set Creatfile=creatobject.createtextfile (Server.MapPath (Catalogue & HTMLName), True,false)
If err.number <> 0 Then
Set creatfile=nothing
Set creatobject=nothing
Err.Clear
Creatdebug=1
Exit Sub
End If
Creatfile.write (htmlcontent)
Creatfile.close
Set creatfile=nothing
Set creatobject=nothing
End Sub

Private Function Checkfolder (ByVal localpath)
On Error Resume Next
Dim FileObject
Dim Patharr,path_level,pathtmp,cpath
LocalPath = Replace (LocalPath, "\", "/")
Set fileobject=server.createobject ("Scripting.FileSystemObject")
Patharr = Split (LocalPath, "/")
Path_level = Ubound (Patharr)
Dim I
For i = 0 to Path_level
If i = 0 Then
pathtmp = Patharr (0) & "/"
Else
pathtmp = pathtmp & Patharr (i) & "/"
End If
CPath = Left (Pathtmp,len (pathtmp)-1)
If not Fileobject.folderexists (Server.MapPath (CPath)) Then Fileobject.createfolder (Server.MapPath (CPath))
Next
Set fileobject=nothing
If Err.number<>0 Then
Err.Clear
Checkfolder = False
Else
Checkfolder = True
End If
End Function

Public Function Writecache (AppName, Value)
Application.Lock
Application (appName) = Value
Application.UnLock
End Function

Public Function ClearCache (appName)
Application.Lock
Application.Contents.Remove (AppName)
Application.UnLock
End Function

Public Sub outputjavainfo (message)
Response.Expires = 0
Response.ExpiresAbsolute = Now ()-1
Response.AddHeader "Pragma", "No-cache"
Response.AddHeader "Cache-control", "private"
Response.CacheControl = "No-cache"
Response.ContentType = "Application/x-javascript"
Response.Write "document.getElementById" ("Updateinfo"). InnerHTML = "" "& Message &" "";
Response.End
End Sub

Public Sub outputinterhtml (message, ShowType)
Response.Write Message
If ShowType = 1 Then
Response.Flush
Else
Response.End
End If
End Sub
End Class
%>

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.