What i want to do is Compare two Strings, but when i compare them -- i want to make it compare Lower Case and Uppercase Letters. For Example, if i wanted to compare two strings:

str1 = "Str";
str2 = "str";

I want to know how i could evaluate these two strings, but make it compare upper and lowercase letters as the same thing -- so if i compared the two strings it would say they were equal; I want it to ignore upper and lowercase letters!!

Is there a function that does this included in the Standard C/C++ Library (NOTE: I use MSVC++ 6); If there is, could somebody please give me an example on how to use it.....

If there isn't, then how could i do this...??

I hope my Question is Clear,
Cya.

02-12-2003

nickname_changed

I think theres a function in the <string> header (strupr()) or something, you'll find it on this site somewhere in the totorial section on strings.

But what would I know, I'm the guy that said 2 / 2 = square root of 2. :)

Paul

02-12-2003

Azuth

The function you're thinking of is toupper, defined in ctype.h IIRC. Convert your strings to upper case (or copies of them if you want to leave the originals unchanged). Then use strcmp to compare them (in string.h).

[edit]
I'm pretty sure strupr is non-standard
[/edit]

02-12-2003

ripper079

This question has been convered many times. A search Here and a reference page will answer you question.

02-12-2003

Cela

>>I want it to ignore upper and lowercase letters!!
If you don't mind using a nonstandard function for convenience then this should work fine for you :-)