Advertisement

strcmpi

Started by January 04, 2003 10:52 AM
1 comment, last by Pipo DeClown 21 years, 10 months ago
is there a function that compares 2 cstrings, is case insensitive, and ANSI C++? .lick
strcmpi...

just

if(strcmpi(str1, str2) == 0)
//do something....

Here is another method, but isn''t the fastest... just written off the top of my head though... Check over it before you go using it.


  bool nocasecmp(const char *s1, const char *s2){  // use your method to test for bad pointers here  while(*s1 && *s2)  {    if(toupper(*s1) != toupper(*s2))      return false;    s1++;    s2++;  }  if(*s1 || *s2)    return false;  return true;}  


Colby
Advertisement
Thanks for the uppercase idea :D Thank you!

.lick

This topic is closed to new replies.

Advertisement