diff --git a/src/cbaselib.c b/src/cbaselib.c index 262a103..65e02db 100644 --- a/src/cbaselib.c +++ b/src/cbaselib.c @@ -245,7 +245,7 @@ int cosmoB_sSplit(CState *state, int nargs, CValue *args) { nIndx = strstr(indx, ptrn->str); cosmoV_pushNumber(state, nEntries++); - cosmoV_pushLString(state, indx, nIndx == NULL ? (indx - str->str) - str->length : nIndx - indx); + cosmoV_pushLString(state, indx, nIndx == NULL ? str->length - (indx - str->str) : nIndx - indx); indx = nIndx + ptrn->length; } while (nIndx != NULL);