- Home
·
- String Manipulation
·
- Searchs for a String list into another string and return which ocurrency and in what position the s
Searchs for a String list into another string and return which ocurrency and in what position the s
Searchs for a String list into another string and return which ocurrency and in what position the string was found.
Rate Searchs for a String list into another string and return which ocurrency and in what position the s
(1(1 Vote))
'| Esta rutina Busca la primer ocurrencia dentro de StringToSearch
'| de cualquier caracter en OcurrencyList. OcurrencyList es una lista
'| de caracteres (caracteres, palabras, simbolos, etc.) separados por
'| espacios. Se devuelve, la cadena encontrada y en que posicion esta.
'| Si no encuentra ninguna ocurrencia devuelve 0 y la cadena vacia.
'| By SysOverflow
Public Sub StringFirstOcurrency(ByVal OcurrencyList As String, ByVal SearchFor As String, ByRef StringFound As String, ByRef StringPos As Integer)
Dim SearchList() As String
Dim bCounter As Integer
Dim iStringPos As Integer
SearchList = Split(OcurrencyList, " ")
bCounter = 1
StringFound = ""
StringPos = 0
Do While bCounter < UBound(SearchList)
iStringPos = InStr(1, SearchFor, SearchList(bCounter))
If iStringPos <> 0 Then Exit Do
Loop
If iStringPos <> 0 Then
StringFound = SearchList(bCounter)
StringPos = iStringPos
End If
End Sub
Searchs for a String list into another string and return which ocurrency and in what position the s Comments
No comments yet — be the first to post one!
Post a Comment