function Helper::width
Returns the width of a string, using mb_strwidth if it is available. The width is how many characters positions the string will use.
32 calls to Helper::width()
- Application::doRenderThrowable in vendor/
symfony/ console/ Application.php - Application::find in vendor/
symfony/ console/ Application.php - Finds a command by name or alias.
- ConsoleSectionOutput::getDisplayLength in vendor/
symfony/ console/ Output/ ConsoleSectionOutput.php - FormatterHelper::formatBlock in vendor/
symfony/ console/ Helper/ FormatterHelper.php - Formats a message as a block of text.
- FormatterHelper::truncate in vendor/
symfony/ console/ Helper/ FormatterHelper.php - Truncates a message to the given length.
File
-
vendor/
symfony/ console/ Helper/ Helper.php, line 40
Class
- Helper
- Helper is the base class for all helper classes.
Namespace
Symfony\Component\Console\HelperCode
public static function width(?string $string) : int {
$string ??= '';
if (preg_match('//u', $string)) {
return (new UnicodeString($string))->width(false);
}
if (false === ($encoding = mb_detect_encoding($string, null, true))) {
return \strlen($string);
}
return mb_strwidth($string, $encoding);
}