語言

StringInfo.SubstringByTextElements 方法

定義

從目前 StringInfo 物件中擷取一組文字元素的子串。

多載

名稱 Description
SubstringByTextElements(Int32)

從當前 StringInfo 物件中擷取一個文字元素子串,從指定的文字元素開始,一直到最後一個文字元素。

SubstringByTextElements(Int32, Int32)

從當前 StringInfo 物件中擷取一個文字元素子串,從指定的文字元素開始,並依規定數量的文字元素繼續搜尋。

SubstringByTextElements(Int32)

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

從當前 StringInfo 物件中擷取一個文字元素子串,從指定的文字元素開始,一直到最後一個文字元素。

public:
 System::String ^ SubstringByTextElements(int startingTextElement);
public string SubstringByTextElements(int startingTextElement);
member this.SubstringByTextElements : int -> string
Public Function SubstringByTextElements (startingTextElement As Integer) As String

參數

startingTextElement
Int32

此物件中 StringInfo 文字元素的零基索引。

傳回

此 StringInfo 物件中的文字元素子串,從參數指定的 startingTextElement 文字元素索引開始,持續到該物件的最後一個文字元素。

例外狀況

startingTextElement 小於零。

-或-

目前 StringInfo 物件值的字串即為空字串(“”)。

備註

考慮一個由五個文字元素組成的字串,索引範圍從 0 到 4。 若 startingTextElement 參數為 1, SubstringByTextElements 方法會回傳一個子字串,包含索引為 1、2、3 和 4 的文字元素。

適用於

SubstringByTextElements(Int32, Int32)

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

從當前 StringInfo 物件中擷取一個文字元素子串,從指定的文字元素開始,並依規定數量的文字元素繼續搜尋。

public:
 System::String ^ SubstringByTextElements(int startingTextElement, int lengthInTextElements);
public string SubstringByTextElements(int startingTextElement, int lengthInTextElements);
member this.SubstringByTextElements : int * int -> string
Public Function SubstringByTextElements (startingTextElement As Integer, lengthInTextElements As Integer) As String

參數

startingTextElement
Int32

此物件中 StringInfo 文字元素的零基索引。

lengthInTextElements
Int32

要檢索的文字元素數量。

傳回

此 StringInfo 物件中的文字元素子串。 子串由參數指定的 lengthInTextElements 文字元素數量組成,並從該參數指定的 startingTextElement 文字元素索引開始。

例外狀況

startingTextElement 小於零。

-或-

startingTextElement 大於或等於當前物件值 StringInfo 的字串長度。

-或-

lengthInTextElements 小於零。

-或-

目前 StringInfo 物件值的字串即為空字串(“”)。

-或-

startingTextElement + lengthInTextElements 指定一個索引,使其大於此 StringInfo 物件中文字元素的數量。

備註

考慮一個由五個文字元素組成的字串,索引範圍從 0 到 4。 若 startingTextElement 參數為 1, lengthInTextElements 參數為 3, SubstringByTextElements 方法會回傳一個子串,包含索引為 1、2 和 3 的文字元素。

適用於