core: use value 2 of keep_eol in function string_split to keep separators at end of string

This commit is contained in:
Sebastien Helleu 2011-10-16 20:12:55 +02:00
parent 2ed8974d2f
commit c161d704f7
4 changed files with 19 additions and 5 deletions

View File

@ -1036,8 +1036,11 @@ Arguments:
* 'string': string to split
* 'separators': delimiters used for split
* 'keep_eol': if different from 0, then each argument will contain all string
until end of line (see example below)
* 'keep_eol':
** 0: each string will contain one word
** 1: each string will contain all string until end of line (see example below)
** 2: same as 1, but do not remove separators at end of string before split
(_new in version 0.3.6_)
* 'num_items_max': maximum number of items created (0 = no limit)
* 'num_items': pointer to int which will contain number of items created

View File

@ -1051,6 +1051,11 @@ Paramètres :
* 'separators' : délimiteurs utilisés pour le découpage
* 'keep_eol' : si différent de 0, alors chaque paramètre contiendra toutes les
chaînes jusqu'à la fin de la ligne (voir exemple ci-dessous)
** 0: chaque chaîne contiendra un mot
** 1: chaque chaîne contiendra toute la chaîne jusqu'à la fin de la ligne (voir
exemple ci-dessous)
** 2: comme 1, mais ne supprime pas les séparateurs en fin de chaîne avant le
découpage (_nouveau dans la version 0.3.6_)
* 'num_items_max' : nombre maximum de chaînes à créer (0 = pas de limite)
* 'num_items' : pointeur vers un entier qui contiendra le nombre de chaînes
créées

View File

@ -1016,8 +1016,14 @@ Argomenti:
* 'string': stringa da dividere
* 'separators': delimitatori usati per dividere
* 'keep_eol': se diversa da 0, allora ogni argomento conterrà tutte le stringhe
fino a fine riga (consultare l'esempio in basso)
* 'keep_eol':
// TRANSLATION MISSING
** 0: each string will contain one word
// TRANSLATION MISSING
** 1: each string will contain all string until end of line (see example below)
// TRANSLATION MISSING
** 2: same as 1, but do not remove separators at end of string before split
(_new in version 0.3.6_)
* 'num_items_max': maximum number of items created (0 = no limit)
* 'num_items': pointer to int which will contain number of items created

View File

@ -860,7 +860,7 @@ string_split (const char *string, const char *separators, int keep_eol,
if (!string || !string[0] || !separators || !separators[0])
return NULL;
string2 = string_strip (string, 1, 1, separators);
string2 = string_strip (string, 1, (keep_eol == 2) ? 0 : 1, separators);
if (!string2 || !string2[0])
return NULL;