C# BigInteger Parse(String, NumberStyles)

Description

BigInteger Parse(String, NumberStyles) Converts the string representation of a number in a specified style to its BigInteger equivalent.

Syntax

BigInteger.Parse(String, NumberStyles) has the following syntax.


public static BigInteger Parse(
  string value,
  NumberStyles style
)

Parameters

BigInteger.Parse(String, NumberStyles) has the following parameters.

  • value - A string that contains a number to convert.
  • style - A bitwise combination of the enumeration values that specify the permitted format of value.

Returns

BigInteger.Parse(String, NumberStyles) method returns A value that is equivalent to the number specified in the value parameter.

Example


using System;// w w  w. j av a 2 s  .  c  o  m
using System.Globalization;
using System.Numerics;

public class Example
{
   public static void Main()
   {
      string[] hexStrings = { "80", "E293", "F9A2FF", "FFFFFFFF", 
                              "080", "0E293", "0F9A2FF", "0FFFFFFFF",  
                              "0080", "00E293", "00F9A2FF", "00FFFFFFFF" };
      foreach (string hexString in hexStrings)
      {
         BigInteger number = BigInteger.Parse(hexString, NumberStyles.AllowHexSpecifier);
         Console.WriteLine("Converted 0x{0} to {1}.", hexString, number);
      }         
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Numerics »




BigInteger
Complex