Signature
stock xs_implode(output[], outsize, delimiter, const input[][], elemsnum){ new pos = 0; new copied; for(new i = 0; i < elemsnum; ++i) { copied = copy(output[pos], outsize - pos, input[i]); pos += copied; if(pos >= outsize) return outsize; // append delimiter output[pos] = delimiter; ++pos; // last check if(pos >= outsize) return outsize; } output[--pos] = 0; // The last char would be delimiter, so skip it. return pos;}
Description
The opposite of xs_explode(). Takes an array of strings and puts them together
in a single string, delimeted by the @delimeter character.
Parameters
- output — The string to store the impoded string into.
- outsize — The size of the output buffer.
- delimeter — The character to put between imploded strings.
- input — The array of strings to implode.
- elemsnum — The number of strings in the input array.
Returns
The number of characters in the final output buffer.