Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > string::compare

Reply
Thread Tools

string::compare

 
 
Flzw
Guest
Posts: n/a
 
      01-27-2005
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.


 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      01-27-2005
Flzw wrote:
> 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?
 
Reply With Quote
 
 
 
 
Jeff Flinn
Guest
Posts: n/a
 
      01-27-2005
Flzw wrote:
> 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:

Matthias wrote:
> 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....html#id576916.

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

Jeff


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments