MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / StrCompareIgnoreCase

Function StrCompareIgnoreCase

src/string.cpp:310–315  ·  view source on GitHub ↗

* Compares two string( view)s, while ignoring the case of the characters. * @param str1 The first string. * @param str2 The second string. * @return Less than zero if str1 < str2, zero if str1 == str2, greater than * zero if str1 > str2. All ignoring the case of the characters. */

Source from the content-addressed store, hash-verified

308 * zero if str1 > str2. All ignoring the case of the characters.
309 */
310int StrCompareIgnoreCase(std::string_view str1, std::string_view str2)
311{
312 CaseInsensitiveStringView ci_str1{ str1.data(), str1.size() };
313 CaseInsensitiveStringView ci_str2{ str2.data(), str2.size() };
314 return ci_str1.compare(ci_str2);
315}
316
317/**
318 * Compares two string( view)s for equality, while ignoring the case of the characters.

Callers 5

operator()Method · 0.85
MatchesExtensionFunction · 0.85
StrEqualsIgnoreCaseFunction · 0.85
StrNaturalCompareFunction · 0.85
string_func.cppFile · 0.85

Calls 3

dataMethod · 0.45
sizeMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected