string class : SubString(int,int) method
Description
Gets a new instance of the string that taken out the specified number of characters from the specified position.
Syntax
stringInstance.SubString(int startPosition, int number)
Arguments
Class | Name | Description |
int | startPosition | Starting position of the search. |
int | number | A number of characters that is removed. |
Return value
Class | Description |
string | A new instance of the string that taken out the specified number of characters from the specified position. |
Sample code
//anyString is a instance of string type.
string subString = anyString.SubString(5, 5);
Notes
It's a wrapper of the System.Globalization.StringInfo.SubstringByTextElements(Int32,Int32).
The index is zero-based.