I have a file with names that I want my program to sort for a certain name. The names are sent into the file as strings. Is there a way to compare strings while keeping in mind the person searching may not use the same case settings(upper case and lower case) as the data file?
I am fairly new to C++. The only way I know to convert case is toupper. I get the message that " 'toupper' : cannot convert parameter 1 from 'std::string' to 'int'"
the line was typed:
toupper() only converts 1 character value to upper case.
Honestly, I don't really know the proper way to change the case of an std::string, nut here's something that would work:
1 2 3
std::string txt;
for (char *a=(char*)txt.c_str();*a;a++)
*a=toupper(*a);
I know, it's not the best way of doing it. Someone is bound sooner or later to post a more STL-oriented solution.