语言

StringInfo.SubstringByTextElements 方法

定义

从当前 StringInfo 对象中检索文本元素的子字符串。

重载

名称 说明
SubstringByTextElements(Int32)

从指定的文本元素开始,从当前 StringInfo 对象中检索文本元素的子字符串,并继续执行最后一个文本元素。

SubstringByTextElements(Int32, Int32)

从指定的文本元素开始,从当前 StringInfo 对象中检索文本元素的子字符串,然后继续执行指定的文本元素数。

SubstringByTextElements(Int32)

Source:
StringInfo.cs
Source:
StringInfo.cs
Source:
StringInfo.cs
Source:
StringInfo.cs
Source:
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)

Source:
StringInfo.cs
Source:
StringInfo.cs
Source:
StringInfo.cs
Source:
StringInfo.cs
Source:
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 的文本元素。

适用于