Visual Basic Getting Last Character of String

If we want to get the last character of a string in Visual Basic, we can do it using the Substring() and Length methods.

Let's examine the example below..

Module ModuleTest Sub Main() Dim myStr As String = "Yazılımı seviyorum" Dim lastChar As String = myStr.Substring(myStr.Length - 1) Console.WriteLine(lastChar) Console.ReadLine() End Sub End Module

It will be printed on the screen as "m".



You May Interest

Visual Basic Reverse Array

Visual Basic Substring Method

How to Find the Name of the Operating System in Visual Basic ?

Visual Basic Randomly Shuffle a List

Visual Basic String Making Lowercase