''
'' FF_REMAIN
'' Return the portion of a string following the first occurrence of
'' a character or group of characters. Compliment function to FF_EXTRACT.
''
'' MainString is searched for the string specified in MatchPattern. If found,
'' all characters after MatchPattern are returned.
'' If MatchPattern is not present in MainString (or is null) then a
'' zero-length empty string is returned.
'' This function is case-sensitive.
''
Function FF_Remain( ByRef nStart As Integer, _
ByRef sMainString As String, _
ByRef sMatchPattern As String _
) As String
Dim nLenMain As Integer = Len(sMainString)
Dim i As Integer
If (nStart = 0) Or (nStart > nLenMain) Then Return ""
If nStart < 0 Then nStart = nLenMain + nStart + 1
i = Instr(nStart, sMainString, sMatchPattern)
If i Then
Function = Mid(sMainString,i+1)
Else
Function = ""
End If
End Function
''
'' FF_REMAINANY
'' Return the portion of a string following the first occurrence of
'' a character or group of characters. Compliment function to FF_EXTRACT.
''
'' MainString is searched for the string specified in MatchPattern. If found,
'' all characters after MatchPattern are returned.
'' MatchPattern specifies a list of single characters to be searched for
'' individually, a match on any one of which will cause the extract operation
'' to be performed after that character.
'' If MatchPattern is not present in MainString (or is null) then a
'' zero-length empty string is returned.
'' This function is case-sensitive.
''
Function FF_RemainAny( ByRef nStart As Integer, _
ByRef sMainString As String, _
ByRef sMatchPattern As String _
) As String
Dim nLenMain As Integer = Len(sMainString)
Dim nLenMatch As Integer = Len(sMatchPattern)
Dim y As Integer
Dim i As Integer
If (nStart = 0) Or (nStart > nLenMain) Then Return ""
If nStart < 0 Then nStart = nLenMain + nStart + 1
' Make nStart zero based because of pointer indexing
nStart = nStart - 1
' Use string pointer indexing for speed
For i = nStart To nLenMain - 1
For y = 0 To nLenMatch - 1
If sMainString[i] = sMatchPattern[y] Then
Return Mid(sMainString, i+2)
End If
Next
Next
Function = ""
End Function