Advertisement
roman_gemini

Get Tag Attribute using Pattern and Path

Jul 15th, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function GetTF(gPatt As String, gFile As String, gA As String) As String
  2.  
  3. Separators = "\"
  4.  
  5. Dim D, LastHas, seper
  6. LastHas = InStr(1, gPatt, gA)
  7. If LastHas = 0 Then Exit Function
  8. seper = 0
  9. zseper = 0
  10. slen = 0
  11.  
  12. For N = 1 To LastHas
  13.   If InStr(1, Separators, Mid(gPatt, N, 1)) > 0 Then
  14.     seper = seper + 1
  15.   End If
  16. Next N
  17.  
  18. For N = 1 To Len(gFile)
  19.   If InStr(1, Separators, Mid(gFile, N, 1)) > 0 Then
  20.     zseper = zseper + 1
  21.   End If
  22.   If seper = zseper Then Exit For
  23. Next N
  24.  
  25. s = InStr(N + 1, gFile, Separators)
  26. If s > 0 Then
  27.   lseper = s
  28.     If s > 1 Then
  29.       If InStr(1, " ", Mid(gFile, s - 1, 1)) > 0 Then
  30.         lseper = s - 1
  31.       End If
  32.     End If
  33. GetTF = Trim(Mid(gFile, N, lseper - N))
  34. Else
  35. GetTF = Trim(Mid(gFile, N))
  36. End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement