共用方式為


How to: Parse URIs in Visual Basic 

This example demonstrates how to use the System.Uri class to parse a URI.

Example

This example uses several methods of a Uri object to get information about a URI.

Dim uriString As String = "https://www.contoso.com/index.htm?date=today"
Dim uriObject As New Uri(uriString)
' Display "Scheme: http"
MsgBox("Scheme: " & uriObject.Scheme)
' Display "Host: www.contoso.com"
MsgBox("Host: " & uriObject.Host)
' Display "Local path: /index.htm"
MsgBox("Local path: " & uriObject.LocalPath)
' Display "Query: ?date=today"
MsgBox("Query: " & uriObject.Query)

See Also

Reference

Uri

Other Resources

Parsing Strings in Visual Basic