content = "张三 123abc 张三 456def 张三 789ghi"
不使用Split函数使content的结果变成类似于 
result1 = "张三 123abc"
result1 = "张三 456def "
result1 = "张三 789ghi"的效果,小弟求教

解决方案 »

  1.   

    result1 = "张三 123abc"
    result2 = "张三 456def "
    result3 = "张三 789ghi"的效果,小弟求教
    写错了是这个效果
      

  2.   

    Private Sub Command1_Click()
     content = "张三 123abc 张三 456def 张三 789ghi"
     s = Len(content)
     j = 0
     i = 1
        Do While i < s
            i = InStr(i, content, "张三")
            If i = 0 Then
                Exit Do
            Else
                i = i + 2
                j = j + 1
            End If
        Loop
           MsgBox j
    End Sub
      

  3.   

    Dim content As String
    content = "张三 123abc 张三 456def 张三 789ghi"Dim i As Integer
    Dim sTemp As String
    Dim sItem() As String
    Dim sStr As String
    Dim n As Integer    ReDim sItem(0)
        content = content & " "
        For i = 1 To Len(content)
            sTemp = Mid$(content, i, 1)
            If sTemp = " " Then
                n = n + 1
                If n = 2 Then
                    sItem(UBound(sItem)) = sStr
                    sStr = ""
                    ReDim Preserve sItem(UBound(sItem) + 1)
                    n = 0
                Else
                    sStr = sStr & " "
                End If
            Else
                sStr = sStr & sTemp
            End If
        Next
        
        For i = 0 To UBound(sItem)
            
            Debug.Print sItem(i)
        Next