-
您的位置:首页 → 技术开发 → ASP技巧 → 不用组件来实现StrCat函数的功能
不用组件来实现StrCat函数的功能
时间:2004/11/7 4:10:00来源:本站整理作者:蓝点我要评论(0)
-
really really slow by nature. This sample code uses classes to speed up the process by ten times. Someone recentally came up with a DLL to do this but not all of us can install a DLL on our ISP's web servers so I wrote this easy to use VB Class for handling string concatenation.
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
Terms of Agreement:
By using this code, you agree to the following terms...
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for langauges that allow it) freely and with no charge.
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
'**************************************
' Name: StrCat - Non DLL version
' Description:ASP's ability to concatena
' ting many strings together is really rea
' lly slow by nature. This sample code use
' s classes to speed up the process by ten
' times. Someone recentally came up with a
' DLL to do this but not all of us can ins
' tall a DLL on our ISP's web servers so I
' wrote this easy to use VB Class for hand
' ling string concatenation.
' By: Kevin Pirkl
'
' Inputs:Public Property Length - To res
' ize the string length. To use it a secon
' d time on another string just set the .L
' ength property to another value or just
' dereference the object and recreate it.
Public Method Add - too add data to the concatenated string.
'
' Assumes:Didnt do much testing except u
' sing it to add together a string of 100,
' 000 characters and it took about 7 secon
' ds which is not bad. If you need to add
' together more than that dont use this. I
' f your catting char strings like "
' >" + whatever then it should be ok.
'
'This code is copyrighted and has ' limited warranties.Please see http://w
' ww.Planet-Source-Code.com/xq/ASP/txtCode
' Id.6342/lngWId.4/qx/vb/scripts/ShowCode.
' htm 'for details. '**************************************
Set X = New strCat' Create an instance of strCat
X.Length = 100001' Change from the default String length of 100,000
str = ""
For I = 1 To X.Length
X.Add("A") '- takes 7 seconds on my computer
'str = str & "A"'- takes 1 minute 7 seconds on my computer
Next
msgBox(Len(X.Value))
X.Length = 101
For I = 1 To X.Length
X.Add("B")
Next
msgBox(Len(X.Value))
Set X = Nothing ' Destroy the instance.
msgBox("Done")
Class strCat
Private IntCntr
Private strArray()
Private intLength
Public Property Get Length
Length = intLength
End Property
Public Property Let Length( ByVal intLen)
intLength = intLen
IntCntr = 0
Redim strArray(1)
strArray(0) = ""
Redim strArray(intLength)
End Property
Public Property Get Value
Value = Join( strArray,"")
End Property
Private Sub Class_Initialize()
IntCntr = 0
Length = 100000
End Sub
Public Function Add( strToAdd)
strArray(IntCntr) = strToAdd
IntCntr= IntCntr + 1
End Function
End Class
相关阅读
Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么
-
热门文章
没有查询到任何记录。
最新文章
VB.NET 2005编写定时关
Jquery get/post下乱码解决方法 前台gbk gb如何使用数据绑定控件显示数据ASP脚本循环语句ASP怎么提速
人气排行
轻松解决"Server Application Error"和iis"一起学习DataGridView调整列宽用ASP随机生成文件名的函数Jquery get/post下乱码解决方法 前台gbk gbODBC Drivers错误80004005的解决办法返回UPDATE SQL语句所影响的行数的方法用Javascript隐藏超级链接的真实地址两个不同数据库表的分页显示解决方案
|
查看所有0条评论>>