1.1 --- a/plugins/include/string.inc Fri Jul 22 13:48:34 2011 -0400
1.2 +++ b/plugins/include/string.inc Sun Jul 24 19:30:15 2011 -0700
1.3 @@ -490,35 +490,34 @@
1.4 * @param buffers An array of string buffers (2D array).
1.5 * @param maxStrings Number of string buffers (first dimension size).
1.6 * @param maxStringLength Maximum length of each string buffer.
1.7 + * @param copyRemainder False (default) discard excess pieces, true to ignore
1.8 + * delimiters after last piece.
1.9 * @return Number of strings retrieved.
1.10 */
1.11 -stock ExplodeString(const String:text[], const String:split[], String:buffers[][], maxStrings, maxStringLength)
1.12 +stock ExplodeStringLumiStance(const String:text[], const String:split[], String:buffers[][], maxStrings, maxStringLength, bool:copyRemainder = false)
1.13 {
1.14 new reloc_idx, idx, total;
1.15 -
1.16 - if (maxStrings < 1 || split[0] == '\0')
1.17 +
1.18 + if (maxStrings < 1 || !split[0])
1.19 {
1.20 return 0;
1.21 }
1.22 -
1.23 +
1.24 while ((idx = SplitString(text[reloc_idx], split, buffers[total], maxStringLength)) != -1)
1.25 {
1.26 reloc_idx += idx;
1.27 - if (text[reloc_idx] == '\0')
1.28 + if (++total == maxStrings)
1.29 {
1.30 - break;
1.31 - }
1.32 - if (++total >= maxStrings)
1.33 - {
1.34 + if (copyRemainder)
1.35 + {
1.36 + strcopy(buffers[total-1], maxStringLength, text[reloc_idx-idx]);
1.37 + }
1.38 return total;
1.39 }
1.40 }
1.41 -
1.42 - if (text[reloc_idx] != '\0' && total <= maxStrings - 1)
1.43 - {
1.44 - strcopy(buffers[total++], maxStringLength, text[reloc_idx]);
1.45 - }
1.46 -
1.47 +
1.48 + strcopy(buffers[total++], maxStringLength, text[reloc_idx]);
1.49 +
1.50 return total;
1.51 }
1.52