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

Strings.GetChar Method

Returns a Char value representing the character from the specified index in the supplied string.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
public static char GetChar(
	string str,
	int Index
)

Parameters

str
Type: System.String
Required. Any valid String expression.
Index
Type: System.Int32
Required. Integer expression. The (1-based) index of the character in str to be returned.

Return Value

Type: System.Char
Returns a Char value representing the character from the specified index in the supplied string.

If Index is less than 1 or greater than the index of the last character in str, an ArgumentException is thrown.

This example shows how to use the GetChar function to return a character from a specified index in a String.


Dim TestString As String = "ABCDE"
Dim TestChar As Char
' Returns "D"
TestChar = GetChar(TestString, 4)


Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.