Mega Code Archive

 
Categories / C++ / String
 

Return true if c1 c2 (ignoring case), false otherwise

#include <algorithm> #include <cctype> #include <iostream> #include <string> using namespace std; // return true if c1 < c2 (ignoring case), false otherwise bool less_than_insensitive( char c1, char c2 ) {    return tolower( static_cast<unsigned char>( c1 ) ) < tolower( static_cast<unsigned char>( c2 ) ); } int main( ) { }