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

Method casecmp_to

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

Source from the content-addressed store, hash-verified

996}
997
998signed char String::casecmp_to(const String& p_str) const
999{
1000 if (is_empty() && p_str.is_empty())
1001 {
1002 return 0;
1003 }
1004 if (is_empty())
1005 {
1006 return -1;
1007 }
1008 if (p_str.is_empty())
1009 {
1010 return 1;
1011 }
1012
1013 const char32_t* that_str = p_str.get_data();
1014 const char32_t* this_str = get_data();
1015
1016 while (true)
1017 {
1018 if (*that_str == 0 && *this_str == 0)
1019 {
1020 return 0; // we're equal
1021 }
1022 else if (*this_str == 0)
1023 {
1024 return -1; // if this is empty, and the other one is not, then we're less.. I think?
1025 }
1026 else if (*that_str == 0)
1027 {
1028 return 1; // otherwise the other one is smaller..
1029 }
1030 else if (*this_str < *that_str)
1031 { // more than
1032 return -1;
1033 }
1034 else if (*this_str > *that_str)
1035 { // less than
1036 return 1;
1037 }
1038
1039 this_str++;
1040 that_str++;
1041 }
1042}
1043
1044signed char String::naturalnocasecmp_to(const String& p_str) const
1045{

Callers

nothing calls this directly

Calls 4

is_emptyFunction · 0.50
get_dataFunction · 0.50
is_emptyMethod · 0.45
get_dataMethod · 0.45

Tested by

no test coverage detected