Avaya Logo

Home

Previous Topic

Next Topic

Book Contents

Book Index

String instructions

The following script instructions recognize the use of the double-quote syntax to indicate a literal, null-terminated ASCII character string. Although the talk instruction also uses a double-quote syntax, the meaning is different. It implies a talkfile search for phrases that match the string.

If r.0 is ...

Then ...

=0

The strings are equal (exactly the same)

<0

The first string is lexicographically less than the second string

>0

The first string is lexicographically greater than the second string

If the optional type.len argument is used, the comparison is limited to the number of characters specified by that argument.

Below are two examples of the strcmp instruction. In the first example, the strcmp instruction returns a value less than 0 because abc is lexicographically less than abx. In other words, the string abc appears before the string abx in an alphabetical listing. In the second example, the return value is greater than 0 because abcd appears before abx in an alphabetical listing even though abcd has more characters than abx.

strcmp("abc","abx")
strcmp("abx","abcd")

Note:
Capital letters are always lexicographically less than lowercase letters and numbers are always lexicographically less than letters.

� 2003 Avaya Inc. All Rights Reserved.