[Off] detectar texto ... vb.
#2

Aca te dejo una funcion que hace lo que pides, la hice algo generica aun que podria mejorarse. Cualquier cosa me avisas:
Код:
Public Function CountReps(ByVal text As String, ByVal word As String, Optional ByVal separator As String = " ", Optional ByVal sensitive As Boolean = False) As Integer
    Dim count As Integer, _
        Items() As String

    If (sensitive = False) Then
        word = word.ToLower()
        text = text.ToLower()
        separator = separator.ToLower
    End If

    Items = text.Split(separator)

    For Each item As String In Items
        If item = word Then
            count += 1
        End If
    Next

    Return count
End Function
Reply


Messages In This Thread
detectar texto ... vb. - by OTACON - 10.09.2013, 21:44
Respuesta: detectar texto ... vb. - by TheChaoz - 11.09.2013, 03:00

Forum Jump:


Users browsing this thread: 1 Guest(s)