public const long MaxValue = 0x7fffffffffffffff;
public const long MinValue = -9223372036854775808;
- public long value;
+ internal long value;
public int CompareTo (object v)
{
if (s.Length == 0)
throw new FormatException ("Input string was not " +
- "in the correct format.");
+ "in the correct format: s.Length==0.");
NumberFormatInfo nfi;
if (fp != null) {
if (s.Substring (pos, nfi.NegativeSign.Length) == nfi.NegativeSign)
throw new FormatException ("Input string was not in the correct " +
- "format.");
+ "format: Has Negative Sign.");
if (s.Substring (pos, nfi.PositiveSign.Length) == nfi.PositiveSign)
throw new FormatException ("Input string was not in the correct " +
- "format.");
+ "format: Has Positive Sign.");
}
if (AllowLeadingSign && !foundSign) {
if (!Int32.ValidDigit (s [pos], AllowHexSpecifier)) {
if (AllowThousands &&
- Int32.FindOther (ref pos, s, nfi.NumberGroupSeparator))
+ (Int32.FindOther (ref pos, s, nfi.NumberGroupSeparator)
+ || Int32.FindOther (ref pos, s, nfi.CurrencyGroupSeparator)))
continue;
else
if (!decimalPointFound && AllowDecimalPoint &&
- Int32.FindOther (ref pos, s, nfi.NumberDecimalSeparator)) {
+ (Int32.FindOther (ref pos, s, nfi.NumberDecimalSeparator)
+ || Int32.FindOther (ref pos, s, nfi.CurrencyDecimalSeparator))) {
decimalPointFound = true;
continue;
}
// Post number stuff
if (nDigits == 0)
- throw new FormatException ("Input string was not in the correct format.");
+ throw new FormatException ("Input string was not in the correct format: nDigits == 0.");
if (AllowTrailingSign && !foundSign) {
// Sign + Currency
if (AllowCurrencySymbol && !foundCurrency) {
// Currency + sign
+ if (nfi.CurrencyPositivePattern == 3 && s[pos++] != ' ')
+ throw new FormatException ("Input string was not in the correct format: no space between number and currency symbol.");
+
Int32.FindCurrency (ref pos, s, nfi, ref foundCurrency);
- if (foundCurrency) {
+ if (foundCurrency && pos < s.Length) {
if (AllowTrailingWhite)
pos = Int32.JumpOverWhite (pos, s, true);
if (!foundSign && AllowTrailingSign)
if (foundOpenParentheses) {
if (pos >= s.Length || s [pos++] != ')')
throw new FormatException ("Input string was not in the correct " +
- "format.");
+ "format: No room for close parens.");
if (AllowTrailingWhite && pos < s.Length)
pos = Int32.JumpOverWhite (pos, s, false);
}
- if (pos < s.Length)
- throw new FormatException ("Input string was not in the correct format.");
+ if (pos < s.Length && s [pos] != '\u0000')
+ throw new FormatException ("Input string was not in the correct format: Did not parse entire string. pos = "
+ + pos + " s.Length = " + s.Length);
if (!negative)