Table of Contents

Method CompareText

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

CompareText(string, string)

Compares two operands using Word's field text ordering.

public static int CompareText(string left, string right)

Parameters

left string

The left operand.

right string

The right operand.

Returns

int

A negative value, zero or a positive value, as Compare(string, string, StringComparison) does.

Remarks

Case-sensitive, and character by character on a fused weight rather than as a multi-level collation. Letters sort above every non-letter; among letters the base letter is the primary key and lowercase sorts immediately before uppercase, giving "a" < "A" < "b" < "B". Non-letters keep their code point, so "(5)" < "0".

The character-by-character part is the load-bearing detail: "Abc" compares greater than "abd" because the very first character settles it. A .NET culture comparison would compare the base letters abc and abd across the whole string first and return the opposite answer, and Ordinal would too, since it puts every uppercase letter below every lowercase one.

Exceptions

ArgumentNullException

left or right is null.