Sun Identity Manager Deployment Reference

cmp Function

Compares two string values. You can use this function to sort a list of strings

The function returns:

Arguments are coerced to strings, if necessary.

Example 1

The following expression returns -1.

<cmp>
    <i>20</i>
    <i>100</i>
 </cmp>

Example 2

The following expression returns -16. This expression returns a number that indicates the difference between the letters r and b when presented in alphabetical order. Since there are 16 letters between the letters b and r, when bob is compared to ray, the value is -16. Alternatively, if r were compared to b, the value returned would be 16.

<cmp>
    <s>bob</s>
    <s>ray</s>
</cmp>

Example 3

The following expression returns 0 (zero).

<cmp>
    <s>daryl</s>
    <s>daryl</s>
 </cmp>