mirror of
https://github.com/yiisoft/yii2.git
synced 2025-10-30 10:08:08 +08:00
Optimize findBetween method to remove calling function mb_substr()
This commit is contained in:
@ -546,14 +546,13 @@ class BaseStringHelper
|
||||
return null;
|
||||
}
|
||||
|
||||
// Cut the string from the start position
|
||||
$subString = mb_substr($string, $startPos + mb_strlen($start));
|
||||
$endPos = mb_strrpos($subString, $end);
|
||||
$startPos += mb_strlen($start);
|
||||
$endPos = mb_strrpos($string, $end, $startPos);
|
||||
|
||||
if ($endPos === false) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return mb_substr($subString, 0, $endPos);
|
||||
return mb_substr($string, $startPos, $endPos - $startPos);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user