2020-09-28 03:51:20 +08:00
|
|
|
string-pad - pad strings to a fixed width
|
|
|
|
=========================================
|
2020-09-28 01:12:42 +08:00
|
|
|
|
|
|
|
Synopsis
|
|
|
|
--------
|
|
|
|
|
|
|
|
.. BEGIN SYNOPSIS
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
string pad [(-r | --right)] [(-c | --char) CHAR] [(-w | --width) INTEGER] [STRING...]
|
|
|
|
|
|
|
|
.. END SYNOPSIS
|
|
|
|
|
|
|
|
Description
|
|
|
|
-----------
|
|
|
|
|
|
|
|
.. BEGIN DESCRIPTION
|
|
|
|
|
2020-09-28 03:51:20 +08:00
|
|
|
``string pad`` extends each STRING to the given width by adding CHAR to the left.
|
2020-09-28 01:12:42 +08:00
|
|
|
|
2020-09-28 03:51:20 +08:00
|
|
|
If ``-r`` or ``--right`` is given, add the padding after a string.
|
2020-09-28 01:12:42 +08:00
|
|
|
|
2020-09-28 03:51:20 +08:00
|
|
|
If ``-c`` or ``--char`` is given, pad with CHAR instead of whitespace.
|
2020-09-28 01:12:42 +08:00
|
|
|
|
2020-09-28 03:51:20 +08:00
|
|
|
The output is padded to the maximum width of all input strings. If ``-w`` or ``--width`` is given, use at least that.
|
2020-09-28 01:12:42 +08:00
|
|
|
|
|
|
|
.. END DESCRIPTION
|
|
|
|
|
|
|
|
Examples
|
|
|
|
--------
|
|
|
|
|
|
|
|
.. BEGIN EXAMPLES
|
|
|
|
|
|
|
|
::
|
|
|
|
|
2020-09-28 03:51:20 +08:00
|
|
|
>_ string pad -w 10 abc
|
2020-09-28 01:12:42 +08:00
|
|
|
abc
|
|
|
|
|
2020-09-28 03:51:20 +08:00
|
|
|
>_ string pad --right --char=🐟 "fish are pretty" "rich. "
|
|
|
|
fish are pretty
|
|
|
|
rich. 🐟🐟🐟🐟
|
2020-09-28 01:12:42 +08:00
|
|
|
|
2020-09-28 03:51:20 +08:00
|
|
|
>_ string pad -w 6 -c- " | " "|||" " | " | string pad -r -w 9 -c-
|
|
|
|
--- | ---
|
|
|
|
---|||---
|
|
|
|
--- | ---
|
2020-09-28 01:12:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
.. END EXAMPLES
|