1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-13 00:34:11 +02:00

Check offset in camelize

This commit is contained in:
Daniel St. Jules
2015-07-29 01:31:53 -07:00
parent fe266445f7
commit 775d004629

View File

@@ -139,7 +139,11 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
$stringy->str = preg_replace_callback(
'/[-_\s]+(.)?/u',
function ($match) use ($encoding) {
return $match[1] ? mb_strtoupper($match[1], $encoding) : '';
if (isset($match[1])) {
return mb_strtoupper($match[1], $encoding);
} else {
return '';
}
},
$stringy->str
);