GetChar Function in VB.NET

How to use GetChar Function?

Explanation

GetChar Function

GetChar Function in Visual Basic.net 2008 is used to return the character of the string from the specified index.
Syntax:

Function GetChar(ByVal str As String,
ByVal Index As Integer) As Char

In the above syntax String specifies the string from which the character with the Index value is returned.
Example:

Module Module1
Sub Main()
Dim Str As String
Str = "Hscripts Welcomes You"
Console.WriteLine("Character at the index value
4 is::" & GetChar(Str, 4))
Console.ReadLine()
End Sub
End Module
Result:

Character at the index value 4 is:: r

In the above GetChar Function example, the character 'r' is at the index 4 of the given string.

Visual Basic Tutorial


Ask Questions

Ask Question