Edit Content
Click on the Edit Content button to edit/add the content.

The CompareStrings Function

Comparing two strings for equality and inequality is straightforward.  However, because XpressDox relies heavily on XPATH (XPATH Tutorial), it also is constrained by some XPATH limitations. For example,

«If(('A' < 'B'))»less«Else()»not less«End()»
«If(('B' < 'A'))»less«Else()»not less«End()»

will result in

not less
not less

being put into the document.

This is because XPATH will only evaluate the comparisons = and != when applied to strings.

In order to test how we normally imagine a string comparison other than equality works, we need the XpressDox CompareStrings function. The usage of this function is illustrated as follows:

«If(CompareStrings('A','B') < 0)»less«Else()»not less«End()»
«If(CompareStrings('A','B') > 0)»greater«Else()»not greater«End()»
«If(CompareStrings('BBC','BBB') > 0)»greater«Else()»not greater«End()»
«If(CompareStrings('B','B') = 0)»Equal«End()»

this would output the following:

not greater

into the document.

Table of Contents