NumberStyles and TryParse
using System;
using System.Globalization;
using System.Numerics;
public class Example
{
public static void Main()
{
string numericString;
BigInteger number = BigInteger.Zero;
// Call TryParse with default values of style and provider.
numericString = " -3 ";
BigInteger.TryParse(numericString, NumberStyles.Integer, null, out number);
numericString = "F14237FFAAC0864";
BigInteger.TryParse(numericString, NumberStyles.AllowHexSpecifier, null, out number);
numericString = "9,111,111,111,111,111.00";
BigInteger.TryParse(numericString, NumberStyles.Any, new CultureInfo("fr-FR"), out number);
numericString = "9 111 111 111 111 111,00";
BigInteger.TryParse(numericString, NumberStyles.Any, new CultureInfo("fr-FR"), out number);
}
}
Related examples in the same category