xs_replace
- Синтаксис
-
stock xs_replace(text[], len, const what[], const with[]) { new occur = 0; new i = 0; new bufPos = 0; new replaceLen = strlen(with); new whatLen = strlen(what); for (; text[i]; ++i) { if (text[i] == what[0]) { new posInWhat=0; new j; for (j = i; j-i < replaceLen && text[j]; ++j, ++posInWhat) { if (text[j] != what[posInWhat]) break; } if (whatLen == posInWhat) { for (new i2 = 0; i2 < replaceLen && bufPos < XS_REPLACEBUF_SIZE; ++i2) xs__replace_buf[bufPos++] = with[i2]; i = j - 1; ++occur; if (bufPos >= XS_REPLACEBUF_SIZE) return occur; continue; } } if (bufPos >= XS_REPLACEBUF_SIZE) return occur; xs__replace_buf[bufPos++] = text[i]; } xs__replace_buf[bufPos] = 0; copy(text, len, xs__replace_buf); return occur; }
Переменная | Описание |
---|---|
Нет агрументов |
- Описание
- This function has no description.