Hi All!
Is there a standart function, to compare two strings together case INsensitive?
strcmp and strncmp compare casesensitive!
thx
Printable View
Hi All!
Is there a standart function, to compare two strings together case INsensitive?
strcmp and strncmp compare casesensitive!
thx
EDIT:
oopsie in codie
Okay, there is a quick non-standard function called stricmp() that may be supported by your compiler. It ignores case when comparing strings.
Yeah works great :)
i guess strnicmp would work too?! [Edit: yes works :)]
thx
you could also for example make everything upper or lower case and just use strncmp
>>non-standard function called stricmp()
>>i guess strnicmp would work too?!
>>you could also for example make everything upper or lower case and just use strncmp
The best way, imo, is to create your own Stricmp() function, that way it's portable. You don't need to convert the two strings to lowercase first, just do that as you go through the arrays:
Code:/* something like: */
if (tolower(s1[i]) != tolower(s2[i]))