[Previous]
[Contents]
[Next]

strcmpi()

compare two strings, ignoring case

Synopsis:

#include <string.h>

int strcmpi( const char *s1, const char *s2 );

Description:

The strcmpi() function compares, with case insensitivity, the string pointed to by s1 to the string pointed to by s2. All uppercase characters from s1 and s2 are mapped to lowercase for the purposes of doing the comparison. The strcmpi() function is identical to the stricmp() function.

Returns:

Value Meaning
< 0 s1 is less than s2
0 s1 is equal to s2
> 0 s1 is greater than s2

Examples:

#include <stdio.h>
#include <string.h>

void main()
  {
    printf( "%d\n", strcmpi( "AbCDEF", "abcdef" ) );
    printf( "%d\n", strcmpi( "abcdef", "ABC"    ) );
    printf( "%d\n", strcmpi( "abc",    "ABCdef" ) );
    printf( "%d\n", strcmpi( "Abcdef", "mnopqr" ) );
    printf( "%d\n", strcmpi( "Mnopqr", "abcdef" ) );
  }

produces the output:

0
100
-100
-12
12

Classification:

WATCOM

Safety:
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

strcmp(), stricmp(), strncmp(), strnicmp()


[Previous]
[Contents]
[Next]