Table of Contents

strchr

    int strcoll(const char *str1, const char *str2); 

strcoll compares 2 strings

C Sourcecode Example

/* 
 * strcoll c example code
 * http://code-reference.com/c/string.h/strcoll 
 */
#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
 
#include <string.h>
 
int main( void ) {
 
char string[] = "am i the same";
char string2[] = "i whant to be the same";
char string3[] = "am i the same";
 
if( strcoll(string,string2) != 0 )
  printf( "%s  and  %s \nare not the same\n\n", string, string2 );
else {
      printf( "%s  and %s \n_are_ the same\n\n", string, string2 );
  }
 
 
if( strcoll(string,string3) != 0 )
  printf( "%s  and  %s \nare not the same\n\n", string, string3 );
else {
      printf( "%s  and %s \n_are_ the same\n\n", string, string3 );
  }
 
 return 0;
}

strcoll Output for this example

  user@host:~$ ./strcoll
  am i the same  and  i whant to be the same 
  are not the same
  
  am i the same  and am i the same 
  _are_ the same