当前位置: 首页 > 图文教程 > 脚本技术 > VBScript > 好玩的vbs特色代码vbs栈类

VBScript
VBS的各种应用的比较实用小代码
用VBS调用程序并对程序的运行情况进行监控的两个代码
禁止QQ上网的vbs代码
一个收集的下载木马并运行的VBS代码
可以将文件转换为vbs语句的vbs代码
收藏的比较精典VBS代码
好玩的vbs特色代码vbs栈类
使用VBScript 中的类组织开发
防SQL注入的VBSrcipt代码
用VBSrcipt判断是否是日期
Stream、WshShell、WshUrlShortcut对象及Shell.Application的参数与使用
用vbs模拟的一个asp的分页显示功能
本地连接禁用/启用批处理脚本
右键发送(sendto),创建快捷方式到自定义的位置 的vbs
WINDOWS脚本实践:为SAP补丁制作的VBS脚本代码
Adsutil.vbs 在脚本攻击中的妙用[我非我原创]
用VBS修改IIS Metabase 的代码
用VBS实现脚本结束进程与防止进程启动
用vbs实现在启动 Windows 资源管理器时打开特定文件夹
用vbs实现的确定共享文件夹的本地路径?

VBScript 中的 好玩的vbs特色代码vbs栈类


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-11   浏览: 47 ::
收藏到网摘: n/a

数据结构的问题相当重要,如果你能描述出一个问题的输入和输出数据结构,那么这个问题就大有希望,数据结构并不是C语言的专利,真正的数据结构是伪代码的。下面这个栈类是我以前搜集别人的代码,实际上每当考虑一个程序问题的时候,尤其是复杂的程序,就应该想到,用什么样的数据去描述你的输入和输出。
'**********************************************
' vbs栈类
' push(string)进栈
' getTop取栈顶元素
' pop去掉栈顶元素
' isempty是否栈空
' isfull是否栈满(pMax设置了大小,可自行修改)
'
' 木鸟 2002.10.10
' http://www.aspsky.net/
'**********************************************
class Stack
private pArr, pString, pMax
private tab
private sub class_initialize()
tab=chr(9)
pMax=1000 '最大容量
end sub
private sub class_terminate()
if isarray(pArr) then
erase pArr
end if
end sub
public function push(str)
if str<>"" and instr(str,tab)<1 and not Isfull then
if isarray(pArr) then
pString=join(pArr,tab)
end if
pString=pString & tab & str
pArr=split(pString,tab)
push=true
else
push=false
end if
end function
public function GetTop()
if not isarray(pArr)<0 then
GetTop=null
else
if ubound(pArr)<0 then
GetTop=null
else
GetTop=pArr(Ubound(pArr))
end if
end if
end function
public function Pop()
if not isArray(pArr) then
Pop=false
else
if Ubound(pArr)<0 then
Pop=false
else
pString=join(pArr,tab)
pString=left(pString,inStrRev(pString,tab)-1)
pArr=split(pString,tab)
Pop=true
end if
end if
end function
public function Isempty()
if not isArray(pArr) then
Isempty=true
else
if Ubound(pArr)<0 then
isempty=true
else
isempty=false
end if
end if
end function
public function Isfull()
if not isArray(pArr) then
Isfull=false
else
if ubound(pArr)<pMax then
Isfull=false
else
Isfull=true
end if
end if
end function
end class