Left Function in VB.NET

What is the use of Left() string function in VB.NET?

Explanation

Left Function

Left Function in Visual Basic.net 2008 returns the specifed number of characters from the left of a string.
Syntax:

Function Left(ByVal str As String,
ByVal Length As Integer) As String

In the above syntax the number of character specified in the Length is returned from the left of the String.
Example:

Module Module1
Sub Main()
Dim Str As String = "RETURN for LEFT Function"
Console.WriteLine("String returned is::" & Left(Str, 6))
Console.ReadLine()
End Sub
End Module
Result:

String returned is:: RETURN

In the above example, 6 characters from the left most part of the string is returned.

Visual Basic Tutorial


Ask Questions

Ask Question