Compare commits

...

2 Commits

Author SHA1 Message Date
Clemens Schwaighofer
45487b0039 Update parseCharacterRanges with dashless 2026-01-14 10:54:54 +09:00
Clemens Schwaighofer
bfc82e12a5 Release: v9.38.0 2026-01-14 10:43:30 +09:00
3 changed files with 10 additions and 1 deletions

View File

@@ -1 +1 @@
9.37.0
9.38.0

View File

@@ -287,6 +287,10 @@ class Strings
// Remove all spaces
$input = str_replace(' ', '', $input);
$result = [];
// if there is no - inside, return unique characters as array
if (strpos($input, '-') === false) {
return array_unique(mb_str_split($input));
}
// Find all patterns like "A-Z" (character-dash-character)
preg_match_all('/(.)-(.)/u', $input, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {

View File

@@ -743,6 +743,11 @@ final class CoreLibsConvertStringsTest extends TestCase
'abcdefghijklmnopqrstuvwxyz0123',
null,
],
'range without dashes' => [
['abcddfff'],
'abcdf',
null,
],
'invalid ranges' => [
['a-あ', 'A-あ', '0-あ'],
'',