MCPcopy Create free account
hub / github.com/MonaSolutions/MonaServer / ICompare

Method ICompare

MonaBase/sources/String.cpp:105–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103
104
105int String::ICompare(const char* value1, const char* value2, size_t size) {
106 if (value1 == value2)
107 return 0;
108 if (!value1 || !(*value1))
109 return -1;
110 if (!value2 || !(*value2))
111 return 1;
112
113 // value1 and value2 size > 0
114
115 int f(0), l(0);
116 do {
117 if (size == 0)
118 return f - l;
119 if (((f = (unsigned char)(*(value1++))) >= 'A') && (f <= 'Z'))
120 f -= 'A' - 'a';
121 if (((l = (unsigned char)(*(value2++))) >= 'A') && (l <= 'Z'))
122 l -= 'A' - 'a';
123 if (size != std::string::npos)
124 --size;
125 } while (f && (f == l));
126
127 return(f - l);
128}
129
130template<typename Type>
131bool String::ToNumber(const char* value, size_t size, Type& result) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected