Hi All!
Is there a standart function, to compare two strings together case INsensitive?
strcmp and strncmp compare casesensitive!
thx
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.
Last edited by Dante Shamest; 10-12-2003 at 11:57 AM.
Yeah works great
i guess strnicmp would work too?! [Edit: yes works ]
thx
Last edited by IceBall; 10-12-2003 at 12:32 PM.
you could also for example make everything upper or lower case and just use strncmp
They say that if you play a Windows Install CD backwords, you hear satanic messages. That's nothing; play it forward and it installs Windows.
>>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]))
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]