I have text file containing list of urls in each line. I read the file using Read text File assigned a string variable for its output.
how to convert the string variable (add urls of each line) to a list.
My intention is to use browser to navigate to each url. Is there any different way to make it work ?
the most simple and straightforward way to do it will be to use a For each activity as follow.
It will always that your files will always contain lines which are url’s.
For each each s as string in file.ReadAllLines(strPath)
‘Navigate logic’
next
If you want something more advance and with more error handling you can replace the ReadAlllines(strPath) by file.ReadAllLines(strPath).Select(Function(L) System.Text.RegularExpressions.Regex.Match(L,“(http|https):[^\s]*”).ToString)
This will extract from each line from the file the url content from it. If there is no url,it will be empty so you need to check if line is not empty when you will navigate.