Code that is fun but not necessarily useful

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.