Class clink Code As follows: Private Mi As Integer
Public function append (I as integer ) as clink
mi = mi + I
set append = mE
end function
Public FunctionGetvalue ()As Integer
Getvalue=Mi
End Function
The usage is as follows: Dim C As Clink
Set C = New Clink
Msgbox C. append ( 1 ). Append ( 2 ). Append ( 3 ). Getvalue
Set C = Nothing
Fun is the use of the append function. There is a usage in programming Ruby, but it just feels interesting.
To determine whether a string is contained, the following is an example: Private Function Includenumber (S As String ) As Boolean
Static C As Collection
Dim I As Integer
Dim V As String
If C Is Nothing Then
Set C = New Collection
For I = 0 To 9
C. Add I, " C " & I
Next
End If
On Error Goto E:
C. Item " C " & S
Includenumber = True
Exit Function
E:
End Function
To put it bluntly, it is also good to make proper use of error processing to make some logical judgments.