Get the best way to get the first number from different lengths in VB.NET

I am new to programming and need some basic knowledge help.

I have a function that accepts an integer value. I want to be able to get this Integrate the first number of an integer (or the first and second numbers in some cases) and perform certain operations on it.

Get integers (or the first and first numbers in VB.NET) 2) What is the best way to get the first number?

firstDigit = number.ToString().Substring(0,1)

firstTwoDigits = number.ToString().Substring(0,2);

int.Parse(firstDigit)

int.Parse(firstTwoDigits)

Wait

I am new to programming and need some basic knowledge help.

I have a function, It accepts an integer value. I want to be able to get the first number of this integer (or the first and second numbers in some cases) and perform certain operations on it.

VB. What is the best way to get the first number of an integer (or first and second) in .NET?

firstDigit = number.ToString().Substring(0,1)

firstTwoDigits = number.ToString() .Substring(0,2);

int.Parse(firstDigit)

int.Parse(firstTwoDigits)

etc.

< /p>

Leave a Comment

Your email address will not be published.