MCPcopy Create free account
hub / github.com/davisking/dlib / case_insensitive_compare

Class case_insensitive_compare

dlib/gui_widgets/widgets.cpp:3144–3165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3142 // ------------------------------------------------------------------------------------
3143
3144 struct case_insensitive_compare
3145 {
3146 bool operator() (
3147 const std::string& a,
3148 const std::string& b
3149 ) const
3150 {
3151 std::string::size_type i, size;
3152 size = std::min(a.size(),b.size());
3153 for (i = 0; i < size; ++i)
3154 {
3155 if (std::tolower(static_cast<unsigned char>(a[i])) < std::tolower(static_cast<unsigned char>(b[i])))
3156 return true;
3157 else if (std::tolower(static_cast<unsigned char>(a[i])) > std::tolower(static_cast<unsigned char>(b[i])))
3158 return false;
3159 }
3160 if (a.size() < b.size())
3161 return true;
3162 else
3163 return false;
3164 }
3165 };
3166
3167 // ------------------------------------------------------------------------------------
3168

Callers 2

set_dirMethod · 0.85
on_root_clickMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected