阅读(3522) (6)

Laravel 8 trim {#collection-method}

2021-07-05 09:43:54 更新

trim 方法用于移除字符串两端的指定字符:

use IlluminateSupportStr;

$string = Str::of('  Laravel  ')->trim();

// 'Laravel'

$string = Str::of('/Laravel/')->trim('/');

// 'Laravel'