How to determines whether a character is a digit in VB.NET

2 Answers

0 votes
Module Module1

    Sub Main()

        Dim ch As Char = "9"

        If (Char.IsNumber(ch)) Then
            Console.WriteLine("yes")
        Else
            Console.WriteLine("no")
        End If

        ch = "a"

        If (Char.IsNumber(ch)) Then
            Console.WriteLine("yes")
        Else
            Console.WriteLine("no")
        End If


    End Sub

End Module

' run:
' 
' yes
' no

 



answered Dec 5, 2016 by avibootz
0 votes
Module Module1

    Sub Main()

        Dim ch As Char = "9"

        If (Char.IsDigit(ch)) Then
            Console.WriteLine("yes")
        Else
            Console.WriteLine("no")
        End If

        ch = "a"

        If (Char.IsDigit(ch)) Then
            Console.WriteLine("yes")
        Else
            Console.WriteLine("no")
        End If


    End Sub

End Module

' run:
' 
' yes
' no

 



answered Dec 5, 2016 by avibootz

Related questions

1 answer 179 views
1 answer 193 views
1 answer 161 views
1 answer 172 views
1 answer 195 views
1 answer 174 views
1 answer 176 views
...