public static BigInteger ParseBigInteger(this NumeralSystem system, string s) { s = system.PrepareForParse(s); var result = new BigInteger(); foreach (var c in s) { var value = system.GetValueForSymbol(c); if (value == -1) { continue; } result = (result * system.Base) + value; } return(result); }