Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function GetField(Packet As String, Field As String, ProcessType As Boolean) As String
- Dim Parse() As String
- Dim X As Long
- Dim Y As Long
- Dim Search As String
- Dim Delimiter As String
- Select Case ProcessType
- Case 0
- Delimiter = "À€"
- Search = "À€" & Trim(Str(Field)) & "À€"
- If Left(Packet, 4) = "YMSG" Then Packet = "À€" & Right(Packet, Len(Packet) - 20)
- Case 1
- Delimiter = "&"
- Search = Trim(Field)
- End Select
- X = InStr(Packet, Search) + Len(Search)
- If X > Len(Search) Then
- Y = InStr(X, Packet, Delimiter)
- If Y > X Then
- GetField = Mid(Packet, X, Y - X)
- Exit Function
- End If
- End If
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement