Laravel 8 finish {#collection-method}
2021-07-19 10:32 更新
finish
方法用于判断指定字符串末尾是否有特定字符,若没有,则将其添加到字符串末尾:
use Illuminate\Support\Str;
$adjusted = Str::of('this/string')->finish('/');
// this/string/
$adjusted = Str::of('this/string/')->finish('/');
// this/string/
以上内容是否对您有帮助:
更多建议: