private bool AfterLoop(INumber number, int nDigits) { if (nDigits == 0) { if (!tryParse) { exc = GetFormatException("nDigits == 0."); } return(false); } number.AfterLoop(this); if (AllowExponent) { FindExponent(ref pos, s); } if (AllowTrailingSign && !foundSign) { // Sign + Currency FindSign(ref pos, s, nfi, ref foundSign, ref negative); if (foundSign) { if (AllowTrailingWhite && !JumpOverWhite(ref pos, s, true, tryParse, ref exc)) { return(false); } if (AllowCurrencySymbol) { FindCurrency(ref pos, s, nfi, ref foundCurrency); } } } if (AllowCurrencySymbol && !foundCurrency) { // Currency + sign if (nfi.CurrencyPositivePattern == 3 && s[pos++] != ' ') { if (!tryParse) { exc = GetFormatException("No space between number and currency symbol"); } return(false); } FindCurrency(ref pos, s, nfi, ref foundCurrency); if (foundCurrency) { if (AllowTrailingWhite && !JumpOverWhite(ref pos, s, true, tryParse, ref exc)) { return(false); } if (!foundSign && AllowTrailingSign) { FindSign(ref pos, s, nfi, ref foundSign, ref negative); } } } if (AllowTrailingWhite && pos < s.Length && !JumpOverWhite(ref pos, s, false, tryParse, ref exc)) { return(false); } if (foundOpenParentheses) { if (pos >= s.Length || s[pos++] != ')') { if (!tryParse) { exc = GetFormatException("No room for close parens."); } return(false); } if (AllowTrailingWhite && pos < s.Length && !JumpOverWhite(ref pos, s, false, tryParse, ref exc)) { return(false); } } if (pos < s.Length && s[pos] != '\u0000') { if (!tryParse) { exc = GetFormatException("Did not parse entire string. pos = " + pos + " s.Length = " + s.Length); } return(false); } if (negative && !number.CheckNegative()) { if (!tryParse) { exc = GetOverflowException("Negative number"); } return(false); } return(true); }