Signature
stock explode_string(const text[], const split[], buffers[][], maxStrings, maxStringLength, bool:copyRemainder = false){ new reloc_idx, idx, total; if(maxStrings < 1 || !split[0]) { return 0; } while((idx = split_string(text[reloc_idx], split, buffers[total], maxStringLength)) != -1) { reloc_idx += idx; if(++total == maxStrings) { if(copyRemainder) { copy(buffers[total-1], maxStringLength, text[reloc_idx-idx]); } return total; } } copy(buffers[total++], maxStringLength, text[reloc_idx]); return total;}
Description
Breaks a string into pieces and stores each piece into an array of buffers.
Parameters
- text — The string to split.
- split — The string to use as a split delimiter.
- buffers — An array of string buffers (2D array).
- maxStrings — Number of string buffers (first dimension size).
- maxStringLength — Maximum length of each string buffer.
-
copyRemainder
—
False (default) discard excess pieces, true to ignore
delimiters after last piece.
Returns
Number of strings retrieved.