/// Parse string to a number. 10 and hex numbers (like 0x222) are allowed. Suffixes like 20.3f are also allowed. public static ValueType ParseNumber(string str) { if (str == null) { throw new ArgumentNullException("str"); } using (var sr = new ParsingReader(str)) { sr.SkipWhiteSpaceAndComments(); ValueType o = sr.ReadNumber(); if (o == null) { throw new ParsingException("Invalid numeric expression at " + sr.ReadLine()); } sr.SkipWhiteSpaceAndComments(); if (sr.Peek() != -1) { throw new ParsingException("Invalid numeric expression, unexpected characters at " + sr.ReadLine()); } return(o); } }