Skip to content

Instantly share code, notes, and snippets.

@JosephPecoraro
Forked from stevewillard/str_cmp
Created November 21, 2008 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JosephPecoraro/27329 to your computer and use it in GitHub Desktop.
Save JosephPecoraro/27329 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 <= 'z' )
a -= 32;
if( b >= 'a' && b <= 'z' )
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