| 450 | } |
| 451 | |
| 452 | static cell_t ReplaceString(IPluginContext *pContext, const cell_t *params) |
| 453 | { |
| 454 | char *text, *search, *replace; |
| 455 | size_t maxlength; |
| 456 | bool caseSensitive; |
| 457 | |
| 458 | pContext->LocalToString(params[1], &text); |
| 459 | pContext->LocalToString(params[3], &search); |
| 460 | pContext->LocalToString(params[4], &replace); |
| 461 | maxlength = (size_t)params[2]; |
| 462 | |
| 463 | /* Account for old binary plugins that won't pass the last parameter */ |
| 464 | if (params[0] == 5) |
| 465 | { |
| 466 | caseSensitive = (bool)params[5]; |
| 467 | } |
| 468 | else |
| 469 | { |
| 470 | caseSensitive = true; |
| 471 | } |
| 472 | |
| 473 | if (search[0] == '\0') |
| 474 | { |
| 475 | return pContext->ThrowNativeError("Cannot replace searches of empty strings"); |
| 476 | } |
| 477 | |
| 478 | return UTIL_ReplaceAll(text, maxlength, search, replace, caseSensitive); |
| 479 | } |
| 480 | |
| 481 | static cell_t ReplaceStringEx(IPluginContext *pContext, const cell_t *params) |
| 482 | { |
nothing calls this directly
no test coverage detected