|
Option Explicit
Class cArr
Private tMin ''//恷弌峙 thisMin
Private tMax ''//恷寄峙
Private tStr ''//方怏堪
Private tSortStr''//電會堪��輝斤揖匯方怏堪序佩荷恬扮閲窒謹肝電會荷恬
Private tLength ''//圷殆倖方
Private Sub Class_Initialize
tMin =0
tMax =0
tStr ="0"
tLength =0
tSortStr=""
End Sub
''//資誼恷弌峙
Property Get cMin
If tMin=0 Then
Dim sStr
If tSortStr="" Then
sStr=Split(cSort,",")
Else
sStr=Split(tSortStr,",")
End If
tMin=sStr(0)
End If
cMin=tMin
End Property
''//資誼恷寄峙
Property Get cMax
If tMax=0 Then
Dim sStr
If tSortStr="" Then
sStr=Split(cSort,",")
Else
sStr=Split(tSortStr,",")
End If
tMax=sStr(Ubound(sStr))
End If
cMax=tMax
End Property
Property Get Length
If tStr="" Or tStr=0 Then
Length =0
Else
tLength =Ubound(Split(tStr,","))+1
Length =tLength
End If
End Property
''//繍方怏堪験公奉來
Property Let srcStr(str)
If str="" Then
tStr="0"
Else
tStr=str
End If
End Property
''//電會��宜會
Public Function cSort
Dim Arr,i
Redim Arr(Ubound(Split(tStr,",")))
Dim tmp,j
For i=0 to Ubound(Arr)
Arr(i)=CDBL(Split(tStr,",")(i))
Next
For I= 0 to Ubound(Arr)
For j=i+1 to Ubound(Arr)
If Arr(i)<Arr(j) Then
tmp =Arr(i)
Arr(i) =Arr(j)
Arr(j) =tmp
End If
Next
Next
tSortStr=Join(Arr,",")
cSort=tSortStr
End Function
''//乏會
Public Function cSortAsc
Dim tmp,i,Arr
If tSortStr="" Then
tmp=cSort
Else
tmp=tSortStr
End If
Redim Arr(Ubound(Split(tmp,",")))
Arr=Split(tmp,",")
For i= Ubound(Arr) to 0 Step -1
cSortAsc=cSortAsc & Arr(i) & ","
Next
cSortAsc=Left(cSortAsc,Len(cSortAsc)-1)
End Function
''//壓隆硫紗圷殆
Public Function AddItem(str)
If tStr="" OR tStr="0" Then
tStr=str
Else
tStr=tStr & "," & str
End If
tMin =0
tMax =0
tSortStr=""
tLength =tLength + 1
AddItem =tStr
End Function
''//念何紗圷殆
Public Function AddItemBefore(str)
If tStr="" OR tStr="0" Then
tStr=str
Else
tStr=str & "," & tStr
End If
tMin =0
tMax =0
tSortStr=""
tLength =tLength + 1
AddItemBefore=tStr
End Function
''//卞茅圷殆
Public Function RemoveItem(str)
tStr =Replace("," & tStr & "," , "," & str & "," , ",")
tStr =Mid(tStr,2,Len(tStr)-2)
tMin =0
tMax =0
tSortStr=Replace("," & tSortStr & "," , "," & str & "," , ",")
tSortStr=Mid(tSortStr,2,Len(tSortStr)-2)
tLength =0
RemoveItem=tStr
End Function
''//壓沫哈了崔紗圷殆
Public Function AddItemI(index,str)
If index>=Length Then
AddItem(str)
Exit Function
End If
If index<=0 Then
AddItemBefore(str)
Exit Function
End if
Dim Arr,i,tmps
Redim Arr(Ubound(Split(tStr,",")))
Arr=Split(tStr,",")
For i=0 to index-1
tmps=tmps & Arr(i) & ","
Next
tmps=tmps & str & ","
For i=index to Ubound(Arr)
tmps=tmps & Arr(i) & ","
Next
tmps =Left(tmps,Len(tmps)-1)
tStr =tmps
tSortStr=""
tLength =tLength+1
tMin =0
tMax =0
AddItemI=tStr
End Function
''//壓沫哈了崔卞茅圷殆
Public Function RemoveItemI(index)
If index>=Length Or index<=0 Then
Exit Function
End If
Dim Arr,i,tmps
Redim Arr(Ubound(Split(tStr,",")))
Arr=Split(tStr,",")
For i=0 to Ubound(Arr)
If i<>index Then tmps=tmps & Arr(i) & ","
Next
tmps=tmps & str & ","
tmps =Left(tmps,Len(tmps)-1)
tStr =tmps
tSortStr=""
tLength =0
tMin =0
tMax =0
RemoveItemI=tStr
End Function
End Class
�┗犲��犀銅橡稷�_蒜遊嫋海利��
‐蕗苧/云嫋坪否譲栖徭利大��凪�犢慫埖杤�旗燕恬宀倖繁鉱泣��音旗燕云嫋羨魁。飛涙吭盃係欺艇議幡旋��萩式扮嚥選狼嫋海評茅�犢慊敞�!
|