MCPcopy Create free account
hub / github.com/chrxh/alien / decomposeCaseInsensitiveMatch

Method decomposeCaseInsensitiveMatch

source/Base/StringHelper.cpp:121–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121StringHelper::Decomposition StringHelper::decomposeCaseInsensitiveMatch(std::string const& str, std::string const& toMatch)
122{
123 std::string strLower = str;
124 std::string toMatchLower = toMatch;
125
126 std::transform(str.begin(), str.end(), strLower.begin(), ::tolower);
127 std::transform(toMatch.begin(), toMatch.end(), toMatchLower.begin(), ::tolower);
128
129 auto findResult = strLower.find(toMatchLower);
130 if (findResult == std::string::npos) {
131 return {.beforeMatch = str};
132 }
133
134 return {.beforeMatch = str.substr(0, findResult), .match = str.substr(findResult, toMatch.size())};
135}

Callers

nothing calls this directly

Calls 4

beginMethod · 0.80
endMethod · 0.80
findMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected