mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-11-09 19:36:15 +00:00
d767ea2336
RIGHT("abc",5) returned "bc" because the start offset went negative and
mb_substr then counted it from the end of the string. Excel returns the
whole text when num_chars is greater than its length, so clamp the offset
at 0.
84 lines
1.3 KiB
PHP
84 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
return [
|
|
[
|
|
'',
|
|
null,
|
|
1,
|
|
],
|
|
[
|
|
'',
|
|
'',
|
|
1,
|
|
],
|
|
[
|
|
'#VALUE!',
|
|
'QWERTYUIOP',
|
|
-1,
|
|
],
|
|
[
|
|
'#VALUE!',
|
|
'QWERTYUIOP',
|
|
'NaN',
|
|
],
|
|
'null length defaults to 0' => [
|
|
'',
|
|
'QWERTYUIOP',
|
|
null,
|
|
],
|
|
'omitted length defaults to 1' => [
|
|
'P',
|
|
'QWERTYUIOP',
|
|
],
|
|
[
|
|
'GHI',
|
|
'ABCDEFGHI',
|
|
3,
|
|
],
|
|
[
|
|
'',
|
|
'ABCDEFGHI',
|
|
0,
|
|
],
|
|
'length greater than text returns all of text' => [
|
|
'ABCDEFGHI',
|
|
'ABCDEFGHI',
|
|
12,
|
|
],
|
|
'length one more than text returns all of text' => [
|
|
'πέντε',
|
|
'πέντε',
|
|
6,
|
|
],
|
|
[
|
|
'πέντε',
|
|
'Ενα δύο τρία τέσσερα πέντε',
|
|
5,
|
|
],
|
|
[
|
|
'τέσσερα πέντε',
|
|
'Ενα δύο τρία τέσσερα πέντε',
|
|
13,
|
|
],
|
|
[
|
|
'τρία τέσσερα πέντε',
|
|
'Ενα δύο τρία τέσσερα πέντε',
|
|
18,
|
|
],
|
|
[
|
|
'UE',
|
|
true,
|
|
2,
|
|
],
|
|
[
|
|
'SE',
|
|
false,
|
|
2,
|
|
],
|
|
'string not specified' => [
|
|
'exception',
|
|
],
|
|
];
|