All pastes #1282612 Raw Edit

Something

public cpp v1 · immutable
#1282612 ·published 2008-12-11 13:19 UTC
rendered paste body
// Função criada por Y_Lessstock explode(string[], dest[][], token = ' ', max = sizeof (dest), ml = sizeof (dest[])){	new		len = strlen(string),		idx,		i,		cur;	while (idx < len)	{		if (string[idx] == token)		{			dest[cur][i] = '\0';			cur++;			if (cur == max)			{				return;			}			i = 0;			while (idx < len && string[idx] == token)			{				idx++;			}		}		else		{			dest[cur][i++] = string[idx++];			if (i == ml)			{				dest[cur][--i] = '\0';				while (idx < len && string[idx] != token)				{					idx++;				}			}		}	}	dest[cur][i] = '\0';}