Skip to content

Instantly share code, notes, and snippets.

@stevewillard
Created November 21, 2008 02:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stevewillard/27324 to your computer and use it in GitHub Desktop.
Save stevewillard/27324 to your computer and use it in GitHub Desktop.
int str_cmp( char *str1, char *str2 ) {
if ( !*str1 && !*str2 )
return 0;
char a = *str1, b = *str2;
if( a >= 'A' && a <= 'a' )
a -= 32;
if( b >= 'A' && b <= 'a' )
b -= 32;
if ( a < b )
return -1;
if ( a > b )
return 1
return str_cmp( ++str1, ++str2 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment