C# BigInteger Parse(String, NumberStyles, IFormatProvider)
Description
BigInteger Parse(String, NumberStyles, IFormatProvider)
Converts the string representation of a number in a specified style
and culture-specific format to its BigInteger equivalent.
Syntax
BigInteger.Parse(String, NumberStyles, IFormatProvider)
has the following syntax.
public static BigInteger Parse(
string value,/* w w w.j a v a 2 s. c o m*/
NumberStyles style,
IFormatProvider provider
)
Parameters
BigInteger.Parse(String, NumberStyles, IFormatProvider)
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.provider
- An object that provides culture-specific formatting information about value.
Returns
BigInteger.Parse(String, NumberStyles, IFormatProvider)
method returns A value that is equivalent to the number specified in the value parameter.
Example
using System;/*w ww . jav a 2 s. com*/
using System.Globalization;
using System.Numerics;
public class Example
{
public static void Main()
{
string[] hexStrings = { "80", "E293", "F9A2FF", "FFFFFFFF",
"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.