CutString3_Search

Using same code in CutString3, this will search for matching items.
Searches for a string inside a string given that CutFrom is list of items
Using CutString3 method
Returns the index found at

CodeFunctionName
What is this?

Public

Tested

Original Work
Function CutString3_Search(CutFrom, SearchFor, Optional Sepa = "{||}")
' Searches for a string inside a string given that CutFrom is list of items
' Using CutString3 method
' Returns the index found at
'
NewCut = CutFrom & Sepa
ThisID = 0
Retur = 0
LastSepa = 1
FindSepa = InStr(LastSepa, NewCut, Sepa)
Do While FindSepa > 0
ThisID = ThisID + 1
Part1 = Mid(NewCut, LastSepa, FindSepa - LastSepa)
If IsNumeric(SearchFor) Then
If Val(Part1) = Val(SearchFor) Then
Retur = ThisID
Exit Do
End If
Else
If UCase(Part1) = UCase(SearchFor) Then
Retur = ThisID
Exit Do
End If
End If
LastSepa = FindSepa + Len(Sepa)
FindSepa = InStr(LastSepa, NewCut, Sepa)
Loop
CutString3_Search = Retur
End Function

CutFrom, SearchFor, Sepa

Views 4,526

Downloads 1,357

CodeID
DB ID