Lumart Lumart - 7 months ago 15 Question

Decimal places in a number on

How do I check how many decimal places does a number have in

For example: Inside a loop I have an if statement and on that statement I want to check if a number has 4 decimal places (8.9659)

Dim numberAsString As String = myNumber.ToString()
Dim indexOfDecimalPoint As Integer = numberAsString.IndexOf(".")
Dim numberOfDecimals As Integer = _
    numberAsString.Substring(indexOfDecimalPoint + 1).Length