Siebel eScript Language Reference > C Language Library Reference > Clib String Methods >

Clib Compare Strings Method


The Clib Compare Strings method performs a comparison between two strings, one byte at a time. It returns one of the following values:

  • If the strings are identical, then it returns the following value:

    0

  • If the ASCII code of the first unmatched character in the string1 argument is:
    • Less than that of the first unmatched character in the string2 argument, then it returns a negative number.
    • Greater than that of the first unmatched character in the string2 argument, then it returns a positive number.

It stops the comparison if one of the following situations occurs:

  • It encounters a mismatch between strings.
  • It encounters a terminating null byte.
Format

Clib.stricmp(string1, string2)
Clib.strcmpi(string1, string2)
Clib.strncmp(string1, string2, maxLen)
Clib.strncmpi(string1, string2, maxLen)
Clib.strnicmp(string1, string2, maxLen)

You can use one of the following:

  • Search that is case-sensitive. You use Clib.strncmp.
  • Search that is not case-sensitive. You use Clib.stricmp or Clib.strcmpi. In a comparison that is not case-sensitive, A and a are the same.

The Clib.strncmp, Clib.strncmpi, and Clib.strnicmp methods stop the comparison when one of the following situations occurs:

  • It has compared the number of bytes that you specify in the maxLen argument.
  • It encounters a terminating null byte.

Table 154 describes the arguments for the Clib Compare Strings method.

Table 154. Arguments for the Clib Compare Strings Method
Argument
Description

string1

A string or a variable that contains a string that this method compares against the string that the string2 argument contains.

string2

A string or a variable that contains a string that this method compares against the string that the string1 argument contains.

maxLen

The number of bytes to compare.

Siebel eScript Language Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.