一個asp快速字串串連類

來源:互聯網
上載者:User
字串

<%
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'快速字串串連類
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'名稱: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
%>



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.