检测函数 asp class_ASP教程-查字典教程网
检测函数 asp class
检测函数 asp class
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:

复制代码 代码如下:

<%

DimCmd

SetCmd=NewCls_Command

ClassCls_Command

PrivateRe

PublicFunctionIsPositiveInteger(value)

SetRe=NewRegExp

Re.Pattern="^[1-9][d]*$"

Re.IgnoreCase=True

Re.Global=True

IsPositiveInteger=Re.Test(value)

SetRe=Nothing

EndFunction

PublicFunctionIsDigit(vString)

IfvString=""ThenIsDigit=False:ExitFunction

SetRe=NewRegExp

Re.Pattern="^[a-z]+$"

Re.Global=True

Re.IgnoreCase=True

Re.MultiLine=True

IsDigit=Re.Test(vString)

SetRe=Nothing

EndFunction

PublicFunctionIsAlpha(vString)

IfvString=""ThenIsAlpha=False:ExitFunction

SetRe=NewRegExp

Re.Pattern="^[d]+$"

Re.Global=True

Re.IgnoreCase=True

Re.MultiLine=True

IsAlpha=Re.Test(vString)

SetRe=Nothing

EndFunction

PublicFunctionIsAlphaDigit(vString)

IfvString=""ThenIsAlphaDigit=False:ExitFunction

SetRe=NewRegExp

Re.Pattern="^[a-zA-Zd]+$"

Re.Global=True

Re.IgnoreCase=True

Re.MultiLine=True

IsAlphaDigit=Re.Test(vString)

SetRe=Nothing

EndFunction

DimTemplateContent,TemplateDeBug

PublicSubLoadTemplate(TemplateName)

OnErrorResumeNext

DimTemplateObject,TemplateFile

SetTemplateObject=Server.CreateObject("Scripting.FileSystemObject")

SetTemplateFile=TemplateObject.OpenTextFile(Server.MapPath(TemplateName))

IfErr.Number<>0Then

Err.Clear

SetTemplateFile=Nothing

SetTemplateObject=Nothing

TemplateDeBug=1

EndIf

TemplateContent=TemplateFile.ReadAll

TemplateFile.Close

SetTemplateFile=Nothing

SetTemplateObject=Nothing

EndSub

DimHtmlContent,CreatDeBug

PublicSubBuildFile(Catalogue,HtmlName)

OnErrorResumeNext

IfNotCheckFolder(Catalogue)Then

CreatDeBug=1

ExitSub

EndIf

DimCreatObject,CreatFile

SetCreatObject=Server.CreateObject("Scripting.FileSystemObject")

SetCreatFile=CreatObject.CreateTextFile(Server.MapPath(Catalogue&HtmlName),True,False)

IfErr.Number<>0Then

SetCreatFile=Nothing

SetCreatObject=Nothing

Err.Clear

CreatDeBug=1

ExitSub

EndIf

CreatFile.Write(HtmlContent)

CreatFile.Close

SetCreatFile=Nothing

SetCreatObject=Nothing

EndSub

PrivateFunctionCheckFolder(byvalLocalPath)

OnErrorResumeNext

DimFileObject

Dimpatharr,path_level,pathtmp,cpath

LocalPath=Replace(LocalPath,"","/")

SetFileObject=Server.CreateObject("Scripting.FileSystemObject")

patharr=Split(LocalPath,"/")

path_level=Ubound(patharr)

Dimi

Fori=0topath_level

Ifi=0Then

pathtmp=patharr(0)&"/"

Else

pathtmp=pathtmp&patharr(i)&"/"

EndIf

cpath=Left(pathtmp,Len(pathtmp)-1)

IfNotFileObject.FolderExists(Server.MapPath(cpath))ThenFileObject.CreateFolder(Server.MapPath(cpath))

Next

SetFileObject=Nothing

IfErr.Number<>0then

Err.Clear

CheckFolder=False

Else

CheckFolder=True

EndIf

EndFunction

PublicFunctionWriteCache(appName,Value)

Application.Lock

Application(appName)=Value

Application.Unlock

EndFunction

PublicFunctionClearCache(appName)

Application.Lock

Application.Contents.Remove(appName)

Application.UnLock

EndFunction

PublicSubOutputJavaInfo(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

EndSub

PublicSubOutputinterHtml(Message,ShowType)

Response.WriteMessage

IfShowType=1Then

Response.Flush

Else

Response.End

EndIf

EndSub

EndClass

%>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新ASP教程学习
    热门ASP教程学习
    编程开发子分类