Advertisement
netrosly

split methods

Mar 1st, 2015
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. #Region "Split Methods"
  2. Public Shared Function getBetween(input As String, before As String, after As String) As String
  3. Try
  4. Return Regex.Split(Regex.Split(input, before)(1), after)(0)
  5. Catch ex As Exception
  6. End Try
  7. Return "Failed"
  8. End Function
  9. Public Shared Function SimpleSplit(input As String, before As String, after As String) As String
  10. input = input.Split(before).Last
  11. input = input.Split(after).First
  12. Return input
  13. End Function
  14. Public Shared Function midReturn(ByVal total As String, ByVal first As String, ByVal last As String)
  15. If last.Length < 1 Then
  16. midReturn = total.Substring(total.IndexOf(first))
  17. End If
  18. If first.Length < 1 Then
  19. midReturn = total.Substring(0, (total.IndexOf(last)))
  20. End If
  21. Try
  22. midReturn =
  23. ((total.Substring(total.IndexOf(first), (total.IndexOf(last) - total.IndexOf(first)))).Replace(first, "")) _
  24. .Replace(last, "")
  25.  
  26. Catch ArgumentOutOfRangeException As Exception
  27. ' midReturn = "ERROR"
  28. End Try
  29. End Function
  30. #End Region
  31. web.Proxy = Nothing
  32. web.Headers.Add("user-agent", "Mozilla/5.0 (Windows; Windows NT 5.1; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4")
  33. Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(Vidlink)
  34. Using response As System.Net.HttpWebResponse = request.GetResponse
  35. Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
  36. Return sr.ReadToEnd
  37. End Using
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement