Right. In vb I'd comment with something like;
Code:
Public Function GetAfter(ByVal strSearch As String, _
ByVal strMarker As String) _
As String
'This will return all the text after the
'first occurance of the specified string
Dim lngMarkerPos As Long 'the position of the marker string withing the searching string
Dim strRest As String 'holds everything after the marker string
'find last occurance of the marker text
lngMarkerPos = InStrRev(strSearch, strMarker)
If lngMarkerPos > 0 Then
'return all text after the marked position
strRest = Right(strSearch, _
(Len(strSearch) - _
(lngMarkerPos + Len(strMarker) - 1) _
) _
)
Else
'if the string was not found, then return all the
'searching string
GetAfter = strSearch
End If
GetAfter = strRest
End Function
Public Function GetFileName(ByVal strLine As String) _
As String
'This will return all the text after the
'first occurance of the specified string
Dim strName As String
'return everything after the backslash
strName = Trim(GetAfter(strLine, "\"))
'return the filename
GetFileName = strName
End Function
maybe overkill, but I've found over the years that it make going back over code a hell of a lot easier