En base a otro hilo en donde comentamos sobre algunos métodos que le "faltaban" a la clase String pongo aquí como la extendí.
' gambas class file
'' This class extends the standard String class in gambas
Export
Create Static
Inherits String
'' This function counts how much times some string apear in other
Public Function StrCount(sWhere As String, sWhich As String) As Integer
Dim i As Integer
Dim Cursor As Integer
Dim Counter As Integer
i = 1
Repeat
Cursor = InStr(sWhere, sWhich, i)
If Cursor > 0 Then
Inc Counter
i = i + Cursor + String.Len(sWhich)
Endif
Until InStr(sWhere, sWhich, i) = 0 Or i > String.Len(sWhich)
Return Counter
End
'' This class extends the standard String class in gambas
Export
Create Static
Inherits String
'' This function counts how much times some string apear in other
Public Function StrCount(sWhere As String, sWhich As String) As Integer
Dim i As Integer
Dim Cursor As Integer
Dim Counter As Integer
i = 1
Repeat
Cursor = InStr(sWhere, sWhich, i)
If Cursor > 0 Then
Inc Counter
i = i + Cursor + String.Len(sWhich)
Endif
Until InStr(sWhere, sWhich, i) = 0 Or i > String.Len(sWhich)
Return Counter
End
Espero les sea de utilidad.
Saludos.