Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0ab4b33 commit 9f16206Copy full SHA for 9f16206
1 file changed
src/Illuminate/Support/Str.php
@@ -196,11 +196,9 @@ public static function slug($title, $separator = '-')
196
*/
197
public static function snake($value, $delimiter = '_')
198
{
199
- return trim(preg_replace_callback('/[A-Z]/', function($match) use ($delimiter)
200
- {
201
- return $delimiter.strtolower($match[0]);
+ $replace = '$1'.$delimiter.'$2';
202
203
- }, $value), $delimiter);
+ return ctype_lower($value) ? $value : strtolower(preg_replace('/(.)([A-Z])/', $replace, $value));
204
}
205
206
/**
0 commit comments