Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing strings 1

Status
Not open for further replies.

jduk

Programmer
Nov 26, 2003
4
0
0
GB
When comparing strings (e.g. using strcmp() ), is there any way in C++ to return a true result if the letters of the string are the same but the case is not?

i.e To return true when comparing 'programming' with 'PROgramming'

Thanks in advance.
 
Try one of the following
[tt]
strcasecmp()
strcmpi()
stricmp()
[/tt]
But there is no standard name for the routine, so you need to go look in string.h to find out how (or even if) your compiler vendor has implemented it.

--
 
don't forget about strncmp. This function is very important when working with binary strings. Also compare for UNICODE:
wcscmp

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top