Table of Contents

Method Evaluate

Namespace
DocWright.Dom.Fields
Assembly
DocWright.Dom.dll

Evaluate(string, FieldComparisonOperator, string, bool, CultureInfo)

Evaluates a comparison whose left operand was not written quoted.

public static bool Evaluate(string left, FieldComparisonOperator comparison, string right, bool rightWasQuoted, CultureInfo culture)

Parameters

left string

The left operand text.

comparison FieldComparisonOperator

The operator.

right string

The right operand text.

rightWasQuoted bool

Ignored. See the remarks.

culture CultureInfo

The culture used to parse numeric operands.

Returns

bool

The comparison result.

Remarks

Superseded by the overload taking leftWasQuoted. Quoting the left operand is what forces a textual comparison; rightWasQuoted is accepted for compatibility and has no effect, because the measurement (WQ-0007) showed wildcard matching does not depend on the right operand's quoting. Callers that know whether the left operand was quoted should use the six-argument overload — this one always assumes it was not, and so compares "5.0" against 5 numerically where Word compares them as text.

Exceptions

ArgumentNullException

left, right or culture is null.

Evaluate(string, FieldComparisonOperator, string, bool, bool, CultureInfo)

Evaluates a comparison.

public static bool Evaluate(string left, FieldComparisonOperator comparison, string right, bool leftWasQuoted, bool rightWasQuoted, CultureInfo culture)

Parameters

left string

The left operand text.

comparison FieldComparisonOperator

The operator.

right string

The right operand text.

leftWasQuoted bool

Whether the left operand was written quoted. A quoted left operand forces a textual comparison even when it parses as a number.

rightWasQuoted bool

Whether the right operand was written quoted. Accepted for symmetry and currently not load-bearing: neither the numeric/textual choice nor wildcard matching depends on it.

culture CultureInfo

The culture used to parse numeric operands. The currency symbol and separators accepted are this culture's, matching Word's locale sensitivity.

Returns

bool

The comparison result.

Exceptions

ArgumentNullException

left, right or culture is null.