StringInfo.SubstringByTextElements 方法

定義

從目前的 StringInfo 物件擷取文字項目的子字串。

多載

SubstringByTextElements(Int32)

在目前的 StringInfo 物件中擷取文字項目的子字串,範圍從指定的文字項目開始,一直持續到最後一個文字項目。

SubstringByTextElements(Int32, Int32)

在目前 StringInfo 物件中擷取文字項目的子字串,範圍從指定的文字項目開始,一直持續到指定的文字項目數目。

SubstringByTextElements(Int32)

來源:
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 物件中擷取文字項目的子字串,範圍從指定的文字項目開始,一直持續到指定的文字項目數目。

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 的文字元素。

適用於