MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / UTIL_ReplaceAll

Function UTIL_ReplaceAll

core/logic/stringutil.cpp:83–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive)
84{
85 size_t searchLen = strlen(search);
86 size_t replaceLen = strlen(replace);
87
88 char *newptr, *ptr = subject;
89 unsigned int total = 0;
90 while ((newptr = UTIL_ReplaceEx(ptr, maxlength, search, searchLen, replace, replaceLen, caseSensitive)) != NULL)
91 {
92 total++;
93 maxlength -= newptr - ptr;
94 ptr = newptr;
95 if (*ptr == '\0')
96 {
97 break;
98 }
99 }
100
101 return total;
102}
103
104/**
105 * NOTE: Do not edit this for the love of god unless you have

Callers 4

ReparseFileMethod · 0.85
ReplaceStringFunction · 0.85
BanIdentityFunction · 0.85
RemoveBanFunction · 0.85

Calls 1

UTIL_ReplaceExFunction · 0.85

Tested by

no test coverage detected