StringInfo.GetNextTextElement 方法

定義

取得指定字串中的第一個文字項目。

多載

GetNextTextElement(String)

取得指定字串中的第一個文字項目。

GetNextTextElement(String, Int32)

取得在指定字串中指定索引處的文字項目。

GetNextTextElement(String)

來源:
StringInfo.cs
來源:
StringInfo.cs
來源:
StringInfo.cs

取得指定字串中的第一個文字項目。

public:
 static System::String ^ GetNextTextElement(System::String ^ str);
public static string GetNextTextElement (string str);
static member GetNextTextElement : string -> string
Public Shared Function GetNextTextElement (str As String) As String

參數

str
String

要從其中取得文字項目的字串。

傳回

含有指定字串中第一個文字項目的字串。

例外狀況

strnull

備註

.NET 會將文字元素定義為顯示為單一字元的文字單位,也就是 grapheme。 文字元素可以是基底字元、Surrogate 配對或合併字元序列。 Unicode Standard 會將 Surrogate 配對定義為單一抽象字元的編碼字元表示法,其中包含兩個程式碼單位的序列,其中配對的第一個單位是高 Surrogate,而第二個則是低 Surrogate。 Unicode 標準會將結合字元序列定義為基底字元和一或多個結合字元的組合。 Surrogate 配對可以代表基底字元或合併字元。

這個方法只會傳回第一個文字專案。 若要逐一查看字串的文字元素,應用程式應該使用 TextElementEnumerator 方法所產生的 GetTextElementEnumerator 物件。

另請參閱

適用於

GetNextTextElement(String, Int32)

來源:
StringInfo.cs
來源:
StringInfo.cs
來源:
StringInfo.cs

取得在指定字串中指定索引處的文字項目。

public:
 static System::String ^ GetNextTextElement(System::String ^ str, int index);
public static string GetNextTextElement (string str, int index);
static member GetNextTextElement : string * int -> string
Public Shared Function GetNextTextElement (str As String, index As Integer) As String

參數

str
String

要從其中取得文字項目的字串。

index
Int32

文字項目開始處的以零起始的索引。

傳回

含有指定字串中指定索引處的文字項目的字串。

例外狀況

strnull

index 超出 str 的有效索引範圍。

備註

.NET 會將文字元素定義為顯示為單一字元的文字單位,也就是 grapheme。 文字元素可以是基底字元、Surrogate 配對或合併字元序列。 Unicode Standard 會將 Surrogate 配對定義為單一抽象字元的編碼字元表示法,其中包含兩個程式碼單位的序列,其中配對的第一個單位是高 Surrogate,而第二個則是低 Surrogate。 Unicode 標準會將結合字元序列定義為基底字元和一或多個結合字元的組合。 Surrogate 配對可以代表基底字元或合併字元。

這個方法只會傳回從指定索引開始之子字串的第一個文字專案。 若要逐一查看字串的文字元素,應用程式應該使用 TextElementEnumerator 方法所產生的 GetTextElementEnumerator

另請參閱

適用於