一个asp快速字符串连接类
程序员文章站
2022-04-14 18:50:35
<% '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% '快速字符串连接类 '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
<%
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'快速字符串连接类
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'名称:class_faststring
'来源:http://www.jansfreeware.com
'整理:qihangnet
'更新:2005年6月15日
'作用:高效地进行字符串连接,比 str = str & "abc"的方法快很多
'授权:免费使用
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
class class_faststring
'************************************
'变量定义
'************************************
'index --- 字符串数组的下标
'ub ------ 用于调整数组度数的整数变量
'ar() ---- 字符串数组
private index, ub, ar()
'************************************
'实例 初始化/终止
'************************************
private sub class_initialize()
redim ar(50)
index = 0
ub = 49
end sub
private sub class_terminate()
erase ar
end sub
'************************************
'事件
'************************************
'默认事件,添加字符串
public default sub add(value)
ar(index) = value
index = index+1
if index>ub then
ub = ub + 50
redim preserve ar(ub)
end if
end sub
'************************************
'方法
'************************************
'返回连接后的字符串
public function dump
redim preserve ar(index-1)
dump = join(ar,"") '关键所在哦^_^
end function
end class
%>
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'快速字符串连接类
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'名称:class_faststring
'来源:http://www.jansfreeware.com
'整理:qihangnet
'更新:2005年6月15日
'作用:高效地进行字符串连接,比 str = str & "abc"的方法快很多
'授权:免费使用
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
class class_faststring
'************************************
'变量定义
'************************************
'index --- 字符串数组的下标
'ub ------ 用于调整数组度数的整数变量
'ar() ---- 字符串数组
private index, ub, ar()
'************************************
'实例 初始化/终止
'************************************
private sub class_initialize()
redim ar(50)
index = 0
ub = 49
end sub
private sub class_terminate()
erase ar
end sub
'************************************
'事件
'************************************
'默认事件,添加字符串
public default sub add(value)
ar(index) = value
index = index+1
if index>ub then
ub = ub + 50
redim preserve ar(ub)
end if
end sub
'************************************
'方法
'************************************
'返回连接后的字符串
public function dump
redim preserve ar(index-1)
dump = join(ar,"") '关键所在哦^_^
end function
end class
%>