| 950 | } |
| 951 | |
| 952 | signed 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 | |
| 998 | signed char String::casecmp_to(const String& p_str) const |
| 999 | { |
no test coverage detected