VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Searchs for a String list into another string and return which ocurrency and in what position the s

by SysOverflow (1 Submission)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 17th September 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

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



'| 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


Download this snippet    Add to My Saved Code

Searchs for a String list into another string and return which ocurrency and in what position the s Comments

No comments have been posted about Searchs for a String list into another string and return which ocurrency and in what position the s. Why not be the first to post a comment about Searchs for a String list into another string and return which ocurrency and in what position the s.

Post your comment

Subject:
Message:
0/1000 characters