How to get the first two digit of int number in VB.NET

1 Answer

0 votes
Imports System

Public Class Test
    Public Shared Sub Main()
        Dim n As Integer = 96123

        Dim first_digit As Integer = n.ToString().Substring(0, 2)
        
        Console.WriteLine(first_digit)
    End Sub
End Class



' run:
'
' 96
'

 



answered Aug 30, 2019 by avibootz
...