XpressDox Help Center

Use Google To Find Help Fast, e.g. xpressdox choosefromlist


Press Getting Started in the XpressDox toolbar for basic template development
Watch the tutorial videos
View command help from list of commands
Press F1 for help on a command in the Command Editor
Email support@xpressdox.com for assistance

The CompareStrings Function


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:

less
not greater
greater
Equal

into the document.