MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / nocasecmp_to

Method nocasecmp_to

modules/gui/gui/src/backend/text_server/ustring.cpp:952–996  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

950}
951
952signed char String::nocasecmp_to(const String& p_str) const
953{
954 if (is_empty() && p_str.is_empty())
955 {
956 return 0;
957 }
958 if (is_empty())
959 {
960 return -1;
961 }
962 if (p_str.is_empty())
963 {
964 return 1;
965 }
966
967 const char32_t* that_str = p_str.get_data();
968 const char32_t* this_str = get_data();
969
970 while (true)
971 {
972 if (*that_str == 0 && *this_str == 0)
973 {
974 return 0; // we're equal
975 }
976 else if (*this_str == 0)
977 {
978 return -1; // if this is empty, and the other one is not, then we're less.. I think?
979 }
980 else if (*that_str == 0)
981 {
982 return 1; // otherwise the other one is smaller..
983 }
984 else if (_find_upper(*this_str) < _find_upper(*that_str))
985 { // more than
986 return -1;
987 }
988 else if (_find_upper(*this_str) > _find_upper(*that_str))
989 { // less than
990 return 1;
991 }
992
993 this_str++;
994 that_str++;
995 }
996}
997
998signed char String::casecmp_to(const String& p_str) const
999{

Callers 1

operator()Method · 0.80

Calls 5

_find_upperFunction · 0.85
is_emptyFunction · 0.50
get_dataFunction · 0.50
is_emptyMethod · 0.45
get_dataMethod · 0.45

Tested by

no test coverage detected