tincho   15-04-2021, 10:59
#1
Esta es la versión "gambosa" de Count de Go.
Código:
'' <b>RAD Extension.</b><br>
'' Counts how much times some string apear in other

Static Public Function Count(sWhere As String, sWhich As String) As Integer

  Dim k As Integer = 1
  Dim q As Integer
  Dim r As Integer

  Repeat
    q = InStr(sWhere, sWhich, k)
    If q > 0 Then
      Inc r
      k = q + String.Len(sWhich)
    Endif
  Until InStr(sWhere, sWhich, k) = 0 Or k > String.Len(sWhere)

  Return r

End
Saludos.
Última modificación: 05-06-2022, 20:17 por tincho.

1 Saludo.
  
Usuarios navegando en este tema: 1 invitado(s)
Powered By MyBB, © 2002-2024 MyBB Group.
Made with by Curves UI.