共用方式為


URI.Host Property

Definition

Returns the host component of this URI.

public string? Host { [Android.Runtime.Register("getHost", "()Ljava/lang/String;", "")] get; }
[<get: Android.Runtime.Register("getHost", "()Ljava/lang/String;", "")>]
member this.Host : string

Property Value

The host component of this URI, or null if the host is undefined

Attributes

Remarks

Returns the host component of this URI.

The host component of a URI, if defined, will have one of the following forms:

<ul>

<li>

A domain name consisting of one or more labels separated by period characters ('.'), optionally followed by a period character. Each label consists of alphanum characters as well as hyphen characters ('-'), though hyphens never occur as the first or last characters in a label. The rightmost label of a domain name consisting of two or more labels, begins with an alpha character. </li>

<li>

A dotted-quad IPv4 address of the form digit+.digit+.digit+.digit+, where no digit sequence is longer than three characters and no sequence has a value larger than 255.

</li>

<li>

An IPv6 address enclosed in square brackets ('[' and ']') and consisting of hexadecimal digits, colon characters (':'), and possibly an embedded IPv4 address. The full syntax of IPv6 addresses is specified in RFC&nbsp;2373: IPv6 Addressing Architecturehttp://www.ietf.org/rfc/rfc2373.txt.

</li>

</ul>

The host component of a URI cannot contain escaped octets, hence this method does not perform any decoding.

Java documentation for java.net.URI.getHost().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to