string::compare

F

Flzw

I've been trying to use std::string::compare and apparently it is case
sensitive, I searched the net but I can't find a way for it not to take case
into account, the solution I have for now is using stricmp with s1.c_str()
and s2.c_str() but I assume there is a better way... Thanks.
 
V

Victor Bazarov

Flzw said:
I've been trying to use std::string::compare and apparently it is case
sensitive, I searched the net but I can't find a way for it not to take case
into account, [...]

Have you tried "case insensitive string comparison" on Google?
 
J

Jeff Flinn

Flzw said:
I've been trying to use std::string::compare and apparently it is case
sensitive, I searched the net but I can't find a way for it not to
take case into account, the solution I have for now is using stricmp
with s1.c_str() and s2.c_str() but I assume there is a better way...
Thanks.

In your case, see http://www.boost.org/doc/html/iequals.html

From another thread:
Hello,

I am missing certain functionality of std::string, so I am currently
writing some helper functions which operate on strings. On of them is

Have you see Pavel Droba's string algorithm library at boost? See
http://www.boost.org/doc/html/string_algo/quickref.html#id576916.

This offers an extensive set of well thought out algorithms. Boost is
extensively tested for portability across many platforms.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top