MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / ImStristr

Function ImStristr

extern/imgui/imgui.cpp:1756–1776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1754}
1755
1756const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end)
1757{
1758 if (!needle_end)
1759 needle_end = needle + strlen(needle);
1760
1761 const char un0 = (char)ImToUpper(*needle);
1762 while ((!haystack_end && *haystack) || (haystack_end && haystack < haystack_end))
1763 {
1764 if (ImToUpper(*haystack) == un0)
1765 {
1766 const char* b = needle + 1;
1767 for (const char* a = haystack + 1; b < needle_end; a++, b++)
1768 if (ImToUpper(*a) != ImToUpper(*b))
1769 break;
1770 if (b == needle_end)
1771 return haystack;
1772 }
1773 haystack++;
1774 }
1775 return NULL;
1776}
1777
1778// Trim str by offsetting contents when there's leading data + writing a \0 at the trailing position. We use this in situation where the cost is negligible.
1779void ImStrTrimBlanks(char* buf)

Callers 1

PassFilterMethod · 0.85

Calls 1

ImToUpperFunction · 0.85

Tested by

no test coverage detected