共用方式為


HOW TO:剖析 Visual Basic 的 URI

這個範例會使用 System.Uri 類別 (Class) 剖析 URI。

範例

這個範例會使用 Uri 物件的數個方法,取得 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)

請參閱

參考

Uri

其他資源

在 Visual Basic 中剖析字串