Guus2005
AWF VIP
- Local time
- Today, 15:22
- Joined
- Jun 26, 2007
- Messages
- 2,642
This function returns the n-th string
Code:
Public Function GetPart(strString As String, strSep As String, intPart As Integer) As String
Dim intFound As Integer
Dim intNext As Integer
intFound = InStr(1, strString, strSep)
If intFound > 0 Then
If intPart = 1 Then
GetPart = Mid$(strString, 1, intFound - 1)
Else 'intPart > 1
GetPart = GetPart(Mid$(strString, intFound + 1), strSep, intPart - 1) 'recursive
End If
Else 'intFound = 0, no occurence of seperator so return complete string
GetPart = strString
End If
End Function