Skip to content

Commit

Permalink
add 'string.[lr]pad' commands
Browse files Browse the repository at this point in the history
  • Loading branch information
pyroscope committed Jun 24, 2018
1 parent 79d5892 commit 1f4f9f9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions docs/include-cmd-scripting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,32 @@ String Functions
:end-before: # END


string.lpad
string.rpad

.. rubric:: *rTorrent-PS 1.1+ only*

.. code-block:: ini
string.lpad = «text», «padlen»[, «padding»] ≫ string
string.rpad = «text», «padlen»[, «padding»] ≫ string
Pad a string at the start or end, to the required padding length (counting UTF-8 code points).
Strings longer than the padding length are returned unchanged.
If no padding string is provided or if it is empty, a single space is assumed.

The first argument can also be of type value, since zero-padding
numbers is a common use-case. Note that for numbers that might be negative,
only padding with spaces makes sense.

.. rubric:: Examples

.. literalinclude:: rtorrent-ps/tests/commands/string.txt
:language: console
:start-at: # string.[lr]pad
:end-before: # END


string.strip
string.lstrip
string.rstrip
Expand Down
2 changes: 1 addition & 1 deletion docs/rtorrent-ps

0 comments on commit 1f4f9f9

Please sign in to comment.