alexsoft / leftpad
PHP 应该只有一个 leftpad 函数
1.1.0
2023-01-05 17:02 UTC
Requires
- php: ^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0
Requires (Dev)
- phpunit/phpunit: ^8.5.31 || ^9.5.27
This package is auto-updated.
Last update: 2024-09-17 23:42:42 UTC
README
整个包仅包含一个文件,包含一个函数 \Alexsoft\Leftpad\leftpad(string $string, int $length, string $filler): string
$string - your initial string
$length - final length of returned string
$filler - symbol with which initial string should be left padded
1. 安装
composer require alexsoft/leftpad
2. 使用
\Alexsoft\Leftpad\leftpad('foo', 5) // => " foo" \Alexsoft\Leftpad\leftpad('1', 3, '0') // => "001"