Yii2-助手(StringHelper)
截断字符串
echo StringHelper::truncate('中文截断字符',4); //'中文截断...'
字符串转数组
StringHelper::explode('this is string',' '); //[ 0 => 'this' 1 => 'is' 2 => 'string' ]
判断是否指定字符串开始
StringHelper::startsWith('指定字符串','字符'); //true
判断是否指定字符串结束
StringHelper::endsWith('指定字符串','字符'); //true
标签:字符,指定,StringHelper,截断,助手,字符串,Yii2
From: https://www.cnblogs.com/hu308830232/p/18105489