BigInteger: Conversion avec la classe NumberStyle””

Author:

Calculer,la,puissance,d'un,nombre,de,type,'BigInteger'
{filelink=20048}

using System;
using System.Globalization;
using System.Numerics;

public class StyleBigInteger
{
   public static void Main()
   {
        BigInteger nombre; 

        nombre = BigInteger.Parse("   -6   ", NumberStyles.Integer);
        Console.WriteLine(nombre);

        nombre = BigInteger.Parse("6", NumberStyles.AllowHexSpecifier);
        Console.WriteLine(nombre);

        try
        {
           nombre = BigInteger.Parse("   -6  ", NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite);
           Console.WriteLine(nombre);
        }
        catch (FormatException e)
        {
           Console.WriteLine(e.Message);
        }                                                     

        try
        {
           nombre = BigInteger.Parse(" 99999999  ", NumberStyles.AllowLeadingSign);
           Console.WriteLine(nombre);
        }
        catch (FormatException e)
        {
           Console.WriteLine(e.Message);
        }
   }
}

Leave a Reply

Your email address will not be published. Required fields are marked *