Method TryParseNumber
TryParseNumber(string?, CultureInfo, out double)
Parses a field operand as a number, by Word's rule.
public static bool TryParseNumber(string? text, CultureInfo culture, out double value)
Parameters
textstringThe operand text.
cultureCultureInfoThe culture supplying the symbol and separators.
valuedoubleThe parsed value.
Returns
Remarks
Accepted: a leading minus, a leading currency symbol, thousands separators, a leading
or trailing decimal point, leading zeros, and a trailing percent sign (which divides by
100, so 50% is 0.5).
Rejected, each because the oracle rejected it: a parenthesized negative
((5) < (4) is false, so (5) is text — the same reading WQ-0006 found
for table cells), scientific notation (1e2 = 100 is false), and a
leading plus (+5 = 5 is false). Phase 14 accepted all three; the first two
were invented outright and the third came in with Float.
The currency symbol and separators recognized are culture's, which
is why the measurements were captured on an en-NZ Word where $ is the
local symbol.
Exceptions
- ArgumentNullException
cultureis null.