Created
July 26, 2014 05:51
-
-
Save mlabbe/fe7f4d0ac9380c425782 to your computer and use it in GitHub Desktop.
Comparing strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int Orion::Stricmp( const char *s1, const char *s2 ) | |
{ | |
const char *p1 = s1; | |
const char *p2 = s2; | |
int result = 0; | |
if ( p1 == p2 ) | |
return result; | |
while (!result) | |
{ | |
result = tolower(*p1) - tolower(*p2); | |
if ( *p1 == '\0' ) | |
break; | |
++p1; | |
++p2; | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment