summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2020-12-21 20:01:28 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2020-12-21 20:01:28 +0100
commitb3dec3176673fa99e57e3916b36ea4367d47c0fa (patch)
treee9a6a6b6926a9abd4c93138ed6e7acb84438a318 /doc
parent87e422f1044068a4d27e5e4bfdbc664d9e4bbc43 (diff)
downloademacs-b3dec3176673fa99e57e3916b36ea4367d47c0fa.tar.gz
Add `string-pad'
* doc/lispref/strings.texi (Creating Strings): Document it. * lisp/emacs-lisp/shortdoc.el (string): Add example. * lisp/emacs-lisp/subr-x.el (string-pad): New function.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/strings.texi9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index e4ca2617512..958ae4c0a15 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -419,6 +419,15 @@ Split @var{string} into a list of strings on newline boundaries. If
@var{omit-nulls}, remove empty lines from the results.
@end defun
+@defun string-pad string length &optional padding
+Pad @var{string} to the be of @var{length} using @var{padding} as the
+padding character (defaulting to the space character). If
+@var{string} is shorter than @var{length}, no padding is done. If
+@var{length} is positive, the padding is done to the end of the
+string, and if it's negative, to the start of the string (using the
+absolute value).
+@end defun
+
@node Modifying Strings
@section Modifying Strings
@cindex modifying strings