MCPcopy Create free account
hub / github.com/avast/retdec / containsCaseInsensitive

Function containsCaseInsensitive

src/utils/string.cpp:335–348  ·  view source on GitHub ↗

* @brief Find out if string contains another string, no matter the case. * * @param str String to search in. * @param sub String to search for. * * @return @c true if string contains another string, @c false otherwise. */

Source from the content-addressed store, hash-verified

333* @return @c true if string contains another string, @c false otherwise.
334*/
335bool containsCaseInsensitive(const std::string &str, const std::string &sub) {
336 if (sub.empty()) {
337 return true;
338 }
339
340 auto it = std::search(
341 str.begin(), str.end(),
342 sub.begin(), sub.end(),
343 [](unsigned char ch1, unsigned char ch2) {
344 return std::tolower(ch1) == std::tolower(ch2);
345 }
346 );
347 return (it != str.end());
348}
349
350/**
351* @brief Returns @c true if @a str contains at least one character from

Callers 11

parseAnnotationsMethod · 0.85
visitMethod · 0.85
loadLtiFileMethod · 0.85
isThumbMethod · 0.85
solveReferencesMethod · 0.85
isToolMethod · 0.85
isToolVersionMethod · 0.85
isArchMethod · 0.85
setArchMethod · 0.85
hasLanguageMethod · 0.85
TEST_FFunction · 0.85

Calls 3

emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

TEST_FFunction · 0.68