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

Function StrStartsWithIgnoreCase

src/string.cpp:257–261  ·  view source on GitHub ↗

* Check whether the given string starts with the given prefix, ignoring case. * @param str The string to look at. * @param prefix The prefix to look for. * @return True iff the begin of the string is the same as the prefix, ignoring case. */

Source from the content-addressed store, hash-verified

255 * @return True iff the begin of the string is the same as the prefix, ignoring case.
256 */
257bool StrStartsWithIgnoreCase(std::string_view str, std::string_view prefix)
258{
259 if (str.size() < prefix.size()) return false;
260 return StrEqualsIgnoreCase(str.substr(0, prefix.size()), prefix);
261}
262
263/** Case insensitive implementation of the standard character type traits. */
264struct CaseInsensitiveCharTraits : public std::char_traits<char> {

Callers 3

ConNetworkAuthorizedKeyFunction · 0.85
ConNewGRFProfileFunction · 0.85
string_func.cppFile · 0.85

Calls 3

StrEqualsIgnoreCaseFunction · 0.85
substrMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected