[String] fix beforeLast/afterLast
This commit is contained in:
parent
c75098ed37
commit
80b4f81ebf
@ -139,7 +139,7 @@ abstract class AbstractString implements \JsonSerializable
|
||||
$n = (string) $n;
|
||||
$j = $this->indexOfLast($n, $offset);
|
||||
|
||||
if (null !== $j && $j > $i) {
|
||||
if (null !== $j && $j >= $i) {
|
||||
$i = $offset = $j;
|
||||
$str->string = $n;
|
||||
}
|
||||
@ -208,7 +208,7 @@ abstract class AbstractString implements \JsonSerializable
|
||||
$n = (string) $n;
|
||||
$j = $this->indexOfLast($n, $offset);
|
||||
|
||||
if (null !== $j && $j > $i) {
|
||||
if (null !== $j && $j >= $i) {
|
||||
$i = $offset = $j;
|
||||
$str->string = $n;
|
||||
}
|
||||
|
@ -711,6 +711,7 @@ abstract class AbstractAsciiTestCase extends TestCase
|
||||
['orld', 'o', 'hello world', 0, false],
|
||||
['abacab', 'ab', 'abacabab', 1, true],
|
||||
['ab', 'ab', 'abacabab', 1, false],
|
||||
['hello world', 'hello', 'hello world', 0, false],
|
||||
];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user