split函数如何得到数组的个数?

解决方案 »

  1.   

    dim A as long
    for each Temp In DDD
       A=A+1
    next TempDDD 为字符串数组
    Temp为数组元素
      

  2.   

    strArr = split(......)
    n = ubound(strarr())
      

  3.   

    用LBound()和UBound()分别判断数组的下界和上界。
      

  4.   

    Option ExplicitPrivate Sub Text1_KeyPress(KeyAscii As Integer)
        If KeyAscii = 13 Then
            Dim Object_Array() As String
            Call SplitChar(Text1.Text, Object_Array, ",")
            Dim i As Integer
            List1.Clear
            For i = 0 To UBound(Object_Array())
                List1.AddItem Object_Array(i)
            Next i
            SendKeys "{home}+{end}"
        End If
    End Sub'功能简介:用于分割字符串
    '参数一:目标字符串
    '参数二:分割字符
    '参数三:空字符数组
    Private Sub SplitChar(ByVal StrObject As String, Object_Array() As String, ByVal StrChar As String)
        Object_Array() = Split(StrObject, StrChar, , vbTextCompare)
    End Sub