CutString3

Cuts string from a larger one based on a specific separator.

CodeFunctionName
What is this?

Public

Tested

Original Work
Function CutString3(CutFrom, iCutID, Sepa )
' In the Name of Allah
' Cut a specified string from a set of string seperated with a seperator
' Get the text with iRecord from sRecord based on its sequence in that text
If Sepa="" Then Sepa = "{||}"
NewCut = CutFrom & Sepa
Part1 = CutFrom
If iCutID > 0 Then
ThisID = 0
LastSepa = 1
FindSepa = InStr(LastSepa, NewCut, Sepa)
Do While FindSepa > 0
ThisID = ThisID + 1
If ThisID = iCutID Then
Part1 = Mid(NewCut, LastSepa, FindSepa - LastSepa)
Exit Do
Else
LastSepa = FindSepa + Len(Sepa)
End If
FindSepa = InStr(LastSepa, NewCut, Sepa)
Loop
End If
CutString3 = Part1
End Function

CutFrom, iCutID, Sepa

Ex, CutString3("Will you|read|my main|string?", 2, "|")
Returns read

Views 4,181

Downloads 1,329

CodeID
DB ID