阅读(3342) (3)

Laravel 8 Str::replaceLast() {#collection-method}

2021-07-14 17:59:25 更新

Str::replaceLast 函数替换字符串中最后一次出现的给定值:

use Illuminate\Support\Str;

$replaced = Str::replaceLast('the', 'a', 'the quick brown fox jumps over the lazy dog');

// the quick brown fox jumps over a lazy dog