Laravel 8 finish {#collection-method}
finish
方法用于判断指定字符串末尾是否有特定字符,若没有,则将其添加到字符串末尾:
use Illuminate\Support\Str;
$adjusted = Str::of('this/string')->finish('/');
// this/string/
$adjusted = Str::of('this/string/')->finish('/');
// this/string/
finish
方法用于判断指定字符串末尾是否有特定字符,若没有,则将其添加到字符串末尾:
use Illuminate\Support\Str;
$adjusted = Str::of('this/string')->finish('/');
// this/string/
$adjusted = Str::of('this/string/')->finish('/');
// this/string/