Mega Code Archive

 
Categories / VB.Net / Data Types
 

Call parse with default values of style and provider supporting tilde as negative sign

Imports System.Numerics Imports System Imports System.Globalization Module Example    Public Sub Main()         Console.WriteLine(BigInteger.Parse("   ~9999  ", NumberStyles.Integer, New BigIntegerFormatProvider()))    End Sub End Module Public Class BigIntegerFormatProvider : Implements IFormatProvider     Public Function GetFormat(ByVal formatType As Type) As Object Implements IFormatProvider.GetFormat         If formatType Is GetType(NumberFormatInfo) Then             Dim numberFormat As New NumberFormatInfo             numberFormat.NegativeSign = "~"             Return numberFormat         Else             Return Nothing         End If     End Function End Class