Cuts right part of a string starting from certain occurrence of a separator until end of string.
Like CutString3 but it will return all items starting i to the end.
Function CutString7(CutFrom, StartFrom_ID_TillEnd, Optional Sepa = "|")
' Cuts a specified string from a set of string separated with a separator
' Returns text starting from the i of StartFrom_ID_TillEnd until the end of string
' Follows same approach as CutString3
'
If Sepa = "" Then Sepa = "|"
NewCut = CutFrom & Sepa
Part1 = CutFrom
If StartFrom_ID_TillEnd > 0 Then
ThisID = 0
LastSepa = 1
FindSepa = InStr(LastSepa, NewCut, Sepa)
Do While FindSepa > 0
ThisID = ThisID + 1
If ThisID = StartFrom_ID_TillEnd Then
Part1 = Mid(NewCut, FindSepa) ' , FindSepa - LastSepa)
Exit Do
Else
LastSepa = FindSepa + Len(Sepa)
End If
FindSepa = InStr(LastSepa, NewCut, Sepa)
Loop
End If
CutString7 = Part1
End Function
' Cuts a specified string from a set of string separated with a separator
' Returns text starting from the i of StartFrom_ID_TillEnd until the end of string
' Follows same approach as CutString3
'
If Sepa = "" Then Sepa = "|"
NewCut = CutFrom & Sepa
Part1 = CutFrom
If StartFrom_ID_TillEnd > 0 Then
ThisID = 0
LastSepa = 1
FindSepa = InStr(LastSepa, NewCut, Sepa)
Do While FindSepa > 0
ThisID = ThisID + 1
If ThisID = StartFrom_ID_TillEnd Then
Part1 = Mid(NewCut, FindSepa) ' , FindSepa - LastSepa)
Exit Do
Else
LastSepa = FindSepa + Len(Sepa)
End If
FindSepa = InStr(LastSepa, NewCut, Sepa)
Loop
End If
CutString7 = Part1
End Function
CutFrom, StartFrom_ID_TillEnd, Optional Sepa = "|"
Print CutString7("some|1|have|to|say|happy|new|year|to someone", 3, "|")
"to|say|happy|new|year|to someone"
"to|say|happy|new|year|to someone"
Views 193
Downloads 68
CodeID
DB ID
ANmarAmdeen
610
Revisions
v1.0
Monday
January
1
2024