次の方法で共有


Uri.GetLeftPart メソッド

指定した URI 部分が返されます。

Public Function GetLeftPart( _
   ByVal part As UriPartial _) As String
[C#]
public string GetLeftPart(UriPartialpart);
[C++]
public: String* GetLeftPart(UriPartialpart);
[JScript]
public function GetLeftPart(
   part : UriPartial) : String;

パラメータ

  • part
    UriPartial 値のうち、返される URI 部分の末尾を指定する値。

戻り値

指定した URI 部分を含む文字列。

解説

GetLeftPart メソッドは、URI の左端から part により指定された位置までの部分を格納した文字列を返します。返された文字列には区切り記号が含まれています。ただし、特定の場合を除き、返される文字列にはフラグメントやクエリとその区切り記号が含まれていることはありません。

GetLeftPart が返す文字列に区切り文字が含まれる状況を次に示します。

  • Scheme にスキーム区切り文字が追加されている。
  • Authority にパス区切り文字が含まれていない。
  • Path に、元の URI のクエリまたはフラグメントの区切り文字以外の区切り文字が含まれている。

次に示す例は、 SchemeAuthority 、または Path を指定して GetLeftPart を呼び出した結果と URI を示します。

URI スキーム 権限 パス
https://www.contoso.com/index.htm#main http:// https://www.contoso.com https://www.contoso.com/index.htm
mailto:user@contoso.com?subject=uri mailto:   mailto:user@contoso.com
nntp://news.contoso.com/123456@contoso.com nntp:// nntp://news.contoso.com nntp://news.contoso.com/123456@contoso.com
news:123456@contoso.com news:   news:123456@contoso.com
file://server/filename.ext file:// file://server file://server/filename.ext
file:/filename.ext file:   file:/filename.ext

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard

参照

Uri クラス | Uri メンバ | System 名前空間