Convert.ToUInt64 (String, IFormatProvider) converts string to 64-bit unsigned integer using culture-specific format
Imports System.Globalization
Module Example
Public Sub Main()
Dim provider As New NumberFormatInfo()
provider.PositiveSign = "pos "
provider.NegativeSign = "neg "
Dim values() As String = { "1234567891", "+12345678912","pos 12345678912", "12345678912.","neg 1", "-1" }
For Each value As String In values
Console.Write("{0,-20} --> ", value)
Try
Console.WriteLine("{0,20}", Convert.ToUInt64(value, provider))
Catch e As FormatException
Console.WriteLine("{0,20}", "Invalid Format")
Catch e As OverflowException
Console.WriteLine("{0,20}", "Numeric Overflow")
End Try
Next
End Sub
End Module
Related examples in the same category