StringInfo.SubstringByTextElements Method

Definition

Retrieves a substring of text elements from the current StringInfo object.

Overloads

SubstringByTextElements(Int32)

Retrieves a substring of text elements from the current StringInfo object starting from a specified text element and continuing through the last text element.

SubstringByTextElements(Int32, Int32)

Retrieves a substring of text elements from the current StringInfo object starting from a specified text element and continuing through the specified number of text elements.

SubstringByTextElements(Int32)

Retrieves a substring of text elements from the current StringInfo object starting from a specified text element and continuing through the last text element.

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

Parameters

startingTextElement
Int32

The zero-based index of a text element in this StringInfo object.

Returns

A substring of text elements in this StringInfo object, starting from the text element index specified by the startingTextElement parameter and continuing through the last text element in this object.

Exceptions

startingTextElement is less than zero.

-or-

The string that is the value of the current StringInfo object is the empty string ("").

Remarks

Consider a string that consists of five text elements, indexed from 0 through 4. If the startingTextElement parameter is 1, the SubstringByTextElements method returns a substring that consists of the text elements for which the indexes are 1, 2, 3, and 4.

Applies to

SubstringByTextElements(Int32, Int32)

Retrieves a substring of text elements from the current StringInfo object starting from a specified text element and continuing through the specified number of text elements.

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

Parameters

startingTextElement
Int32

The zero-based index of a text element in this StringInfo object.

lengthInTextElements
Int32

The number of text elements to retrieve.

Returns

A substring of text elements in this StringInfo object. The substring consists of the number of text elements specified by the lengthInTextElements parameter and starts from the text element index specified by the startingTextElement parameter.

Exceptions

startingTextElement is less than zero.

-or-

startingTextElement is greater than or equal to the length of the string that is the value of the current StringInfo object.

-or-

lengthInTextElements is less than zero.

-or-

The string that is the value of the current StringInfo object is the empty string ("").

-or-

startingTextElement + lengthInTextElements specify an index that is greater than the number of text elements in this StringInfo object.

Remarks

Consider a string that consists of five text elements, indexed from 0 through 4. If the startingTextElement parameter is 1 and the lengthInTextElements parameter is 3, the SubstringByTextElements method returns a substring that consists of the text elements for which the indexes are 1, 2, and 3.

Applies to