AMX Mod X API Documentation

Signature
stock xs_explode(const input[], output[][], delimiter, maxelems, elemsize){ new nIdx = 0; new nLen = 0; new copied = 0; while(nLen < strlen(input) && nIdx < maxelems) { copied = copyc(output[nIdx++], elemsize, input[nLen], delimiter); if(copied == elemsize) { // maybe it got force-stopped because of maxsize // so check whether we have to skip something if(input[nLen + copied] != delimiter && input[nLen + copied] != 0) { new found = xs_strchr(input[nLen + copied], delimiter); if(found == -1) break; copied += found; } } nLen += copied + 1; // +1: skip delimiter } return nIdx;}
Description

"Explodes" a string, breaking it at the @delimeter character and putting

each exploded part into the @output array.

Parameters
  • input The input string to be exploded.
  • output The output array of string where exploded string will be stored.
  • delimeter The character to break the string at.
  • maxelems Maximum amount of elements in @output.
  • elemsize Maximum size of each string in the @output array.
Returns

The number of strings successfully exploded.

Назад
Верх