如:abacdefafefsdfwa然后可以得到上边字符串的a为4个那个函数是什么???

解决方案 »

  1.   

    a = "abacdefafefsdfwa"
    b = Len(a) - Len(Replace(a, "a", ""))
    MsgBox b
      

  2.   

    确实高呀!
    dim x
    x=split(a,"a")
    debug.print ubound(x)+1 '
      

  3.   

    应该是
    debug.print ubound(x)-1
      

  4.   

    '在字符串str1中查找字符串str2的出现个数
    Public Function str_count(ByVal str1 As String, ByVal str2 As String) As Integer
        Dim count As Integer
        Dim  start As Integer
        Dim  len_str2 As Integer
        count = -1
        start = 1
        len_str2 = Len(str2)
        Do
            count = count + 1
            start = InStr(start, str1, str2) + len_str2
        Loop Until start = len_str2
        str_count = count
    End Function
      

  5.   

    ljc_zy(彷徨)结果有误,改为:Private Sub Command1_Click()
    Const x = "abacdefafefsdfwa"
    MsgBox UBound(Split(x, "a"))
    End Sub
      

  6.   

    這個很好理解
    dim aa as string
    dim x as integer
    aa = "abacdefafefsdfwa"
    x = Len(a) - Len(Replace(a, "a", ""))x為所要找的字符串的個數
      

  7.   

    早就有人问过:
    建议提问前先搜索
    http://community.csdn.net/Expert/topic/3083/3083428.xml?temp=.4085199