CutString9

Cuts from CutFrom starting from any of items found from StartingFrom_ListofStrings (separated by |), or start of string
Until any of Until_ListofStrings is found (separated by |), or end of string.
This is the most advanced CutString among the set of CutString functions

CodeFunctionName
What is this?

Public

Tested

Original Work
Function CutString9(CutFrom, StartingFrom_ListofStrings, Until_ListofStrings, Optional Sepa = "|", Optional StartSearchingFrom = 1)
    ' Cuts from CutFrom starting from any of items found from StartingFrom_ListofStrings (separated by |), or start of string
    '    Until any of Until_ListofStrings is found (separated by |), or end of string
    ' if none found, will return CutFrom
    '
    ' Needs vbinstr()
    Rett = CutFrom
    For Each Lii In Split(StartingFrom_ListofStrings, Sepa)
        St01 = VBInstr(Lii, Rett, StartSearchingFrom)
        If St01 > 0 Then
            Rett = Mid(Rett, St01 + Len(Lii))
            Exit For
        End If
    Next
    For Each Lii In Split(Until_ListofStrings, Sepa)
        St01 = VBInstr(Lii, Rett)
        If St01 > 0 Then
            Rett = Left(Rett, St01 - Len(Lii))
            Exit For
        End If
    Next
    CutString9 = Rett
End Function

CutFrom, StartingFrom_ListofStrings, Until_ListofStrings, Optional Sepa = "|", Optional StartSearchingFrom = 1

Views 183

Downloads 68

CodeID
DB ID