Web scraping: Difference between revisions

1,109 bytes removed ,  6 years ago
Undo revision 259817 by AykayayCiti (talk)
(Undo revision 259816 by AykayayCiti (talk))
(Undo revision 259817 by AykayayCiti (talk))
Line 1,856:
Mar. 05, 00:57:37 UTC Universal Time
</pre>
 
=={{header|Visual Basic .NET}}==
New, .NET way with StringReader:
<lang vbnet>Imports System.Net
Imports System.IO
Dim client As WebClient = New WebClient()
Dim content As String = client.DownloadString("http://tycho.usno.navy.mil/cgi-bin/timer.pl")
Dim sr As New StringReader(content)
While sr.peek <> -1
Dim s As String = sr.ReadLine
If s.Contains("UTC") Then
Dim time As String() = s.Substring(4).Split(vbTab)
Console.WriteLine(time(0))
End If
End While</lang>
 
Alternative, old fashioned way using VB "Split" function:
<lang vbnet>Imports System.Net
Dim client As WebClient = New WebClient()
Dim content As String = client.DownloadString("http://tycho.usno.navy.mil/cgi-bin/timer.pl")
Dim lines() As String = Split(content, vbLf) 'may need vbCrLf
For Each line In lines
If line.Contains("UTC") Then
Dim time As String() = line.Substring(4).Split(vbTab)
Console.WriteLine(time(0))
End If
Next</lang>
 
=={{header|zkl}}==