vb找到某个头数,尾数,去某个头数,尾数!
比如:01,02,03,04,05……~80 ,80个数字中,
[找到]头数为 0 ,1,2,的!列出来
再在找到0,1,2头的数中[找到]尾数为 8,9 ,再列出来!
再在找到尾数8,9的数中,[去掉]头数为 0 的数值,
在去掉 尾数 为8的数字!
[0~80个数中,找到0,1,2头数,再在找到的头数中找到8,9的尾数,在去掉0的头数,再去掉8的尾数] 
就是这样,请求VB友帮下,谢谢了 

解决方案 »

  1.   

    Private Sub Form_Load()
    Dim i As Integer
    Dim j As String
    Dim k As String
    Dim p As String
    Dim l As String
        'ͷΪ0,1,2
        For i = 1 To 80
            If i < 10 Then
                j = j & "," & "0" & i
                If i = 8 Or i = 9 Then
                    k = k & "," & "0" & i
                End If
            ElseIf Left(i, 1) = 1 Or Left(i, 1) = 2 Then
                j = j & "," & i
                If Right(i, 1) = 8 Then
                    p = p & "," & i
                ElseIf Right(i, 1) = 9 Then
                    l = l & "," & i
                End If
            End If
        Next i
        k = k & p & l
        p = p & l
        j = Mid(j, 2, Len(j))
        Debug.Print j
        k = Mid(k, 2, Len(k))
        Debug.Print k
        p = Mid(p, 2, Len(p))
        Debug.Print p
        l = Mid(l, 2, Len(l))
        Debug.Print l
    End Sub
      

  2.   

    Option ExplicitPrivate Sub Command1_Click()
        Dim I As Long, J(79) As String, Out() As String
        
        For I = 1 To 80
            J(I - 1) = Format(I, "00")
        Next
        
        Out() = FindNum(J(), 1, False, "0", "1", "2")           '找0,1,2头,返回找到的
        Out() = FindNum(Out(), 2, False, "8", "9")              '找8,9尾,返回找到的
        Out() = FindNum(Out(), 1, True, "0")                    '找0头,返回其它
        Out() = FindNum(Out(), 2, True, "8")                    '找8尾,返回其它
        
        MsgBox Join(Out(), ",")
    End SubPrivate Function FindNum(ByRef InArr() As String, ByVal Offset As Long, ByVal IsDel As Boolean, ParamArray sFind()) As String()
        '按指定的包含关系输出元素
        '
        'Offset - 要找的字符的位置
        'IsDel  - True=返回找到的元素以外的,False=返回找到的
        '
        Dim I As Long, J As Long, K As Long, L As String
        Dim bFind As Boolean, Out() As String
        
        ReDim Out(0)
        K = 0
        
        For I = 0 To UBound(InArr)
            L = Mid(InArr(I), Offset, 1)
            bFind = False
            For J = 0 To UBound(sFind)
                If sFind(J) = L Then
                    If IsDel = False Then
                        ReDim Preserve Out(K)
                        
                        Out(K) = InArr(I)
                        K = K + 1
                    End If
                Else
                    If IsDel = True Then
                        ReDim Preserve Out(K)
                        
                        Out(K) = InArr(I)
                        K = K + 1
                    End If
                End If
            Next
        Next
        Debug.Print Join(Out(), ",")
        FindNum = Out
    End Function
    还是发上来吧