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

VBScript
利用vbs脚本实现设置IE的打印页眉页脚信息
两个vbs脚本利用了wscirpt.network
一次载入2个vbs脚本的方法
一个可以更换windows xp or 2003的序列号的vbs脚本
利用VBS脚本自动创建计算机帐户的代码
利用VBS脚本轻松盗U盘数据
脚本-学习VBS的一个不错的教程
什么是 WSH(脚本宿主)的详细解释
WSH 5.6(脚本宿主) 的新增功能
雷客图ASP站长安全助手vbs测试版代码
ntiIframe.vbs用于批量清除被添加到文件中的恶意代码
用vbs控制iis创建虚拟目录的代码
vbscript自动配置IIS的代码
使用ADSI、ASP和一对魔术戏法自动地创立一个虚拟目录的方法
妙用VBScript自制IE工具栏按钮的代码
利用vbs类实现css按钮的代码
VBS中转换二进制数据为字符串常用办法
提供个可以显示农历的VBS代码
在一个vbs中包含其他vbs文件的方法
用vbs实现定时运行web文件的方法

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-11   浏览: 48 ::
收藏到网摘: 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