Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>strnicmp() compare n characters of strings, case insensitive</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 strnicmp()              Compare n Characters of Strings, Case Insensitive

 #include   <string.h>                   Required for declarations only

 int           strnicmp(str1,str2,n);
 const char *str1;
 const char *str2;
 size_t  n; Number of characters compared

    strnicmp() performs a lexicographic comparison of up to 'n'
    characters of 'string1' and 'string2'.  Unlike strncmp(), strnicmp()
    is case-insensitive; that is uppercase and lowercase forms of a
    letter are considered equivalent.

    Returns:    A value indicating the relationship between the two
                strings:

                      Comparison          Returned

                'string1' <  'string2'      < 0
                'string1' == 'string2'        0
                'string1' >  'string2'      > 0

      Notes:    strnicmp() expects to operate on null-terminated strings.

 Portability:   Applies to MS DOS only.

   -------------------------------- Example ---------------------------------
 The following statements compare 'n' characters of two strings. The
                strings are equivalent.

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

           char str1[20] = "eucalyptus trees";
           char str2[20] = "Eucalyptus trees";
           int rslt;

           main()
           {
               if((rslt = strnicmp(str1,str2,strlen(str1))) == 0)
                  printf("strings are equivalent");
               else
                  printf("strings are not equivalent");
           }


See Also: strncmp() strcmp()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson