mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-21 20:27:13 +01:00
Fix bug in String library which would cause the first character to be skipped from the first chunk if no previous match was found.
This commit is contained in:
parent
2d433c34b4
commit
3e8250d04b
@ -886,7 +886,7 @@ static SQInteger SplitWhereCharImpl(HSQUIRRELVM vm, int(*fn)(int), bool neg)
|
||||
if ((fn(*itr) == 0) == neg)
|
||||
{
|
||||
// Are there any characters before this match?
|
||||
if ((itr - last) > 1 && (++last != '\0'))
|
||||
if ((itr - last) > 1 && (last != '\0'))
|
||||
{
|
||||
// Push this chunk of string on the stack
|
||||
sq_pushstring(vm, last, itr - last);
|
||||
@ -908,12 +908,12 @@ static SQInteger SplitWhereCharImpl(HSQUIRRELVM vm, int(*fn)(int), bool neg)
|
||||
return r; // We're done here
|
||||
}
|
||||
// Update the position of the last found match
|
||||
last = itr;
|
||||
last = (itr + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Push the remaining chunk, if any
|
||||
if (*(++last) != '\0')
|
||||
if (*last != '\0')
|
||||
{
|
||||
// Push this chunk of string on the stack
|
||||
sq_pushstring(vm, last, -1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user