Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

StringInfo.SubstringByTextElements Method (Int32, Int32)

Note: This method is new in the .NET Framework version 2.0.

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.

Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)

public string SubstringByTextElements (
	int startingTextElement,
	int lengthInTextElements
)
public String SubstringByTextElements (
	int startingTextElement, 
	int lengthInTextElements
)
public function SubstringByTextElements (
	startingTextElement : int, 
	lengthInTextElements : int
) : String

Parameters

startingTextElement

The index of a text element in this StringInfo object.

lengthInTextElements

The number of text elements to retrieve.

Return Value

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.
Exception typeCondition

ArgumentOutOfRangeException

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.

The startingTextElement index is zero-based.

Consider a string that consists of five text elements; that is, the text elements in the string are 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 whose indexes are 1, 2, and 3.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.