| 81 | } |
| 82 | |
| 83 | unsigned 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 |
no test coverage detected