diff options
Diffstat (limited to 'doc/lispref/strings.texi')
-rw-r--r-- | doc/lispref/strings.texi | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 0f157c39d63..1e5f52ddfdd 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -381,6 +381,52 @@ The default value of @var{separators} for @code{split-string}. Its usual value is @w{@code{"[ \f\t\n\r\v]+"}}. @end defvar +@defun string-clean-whitespace string +Clean up the whitespace in @var{string} by collapsing stretches of +whitespace to a single space character, as well as removing all +whitespace from the start and the end of @var{string}. +@end defun + +@defun string-fill string length +Attempt to Word-wrap @var{string} so that no lines are longer than +@var{length}. Filling is done on whitespace boundaries only. If +there are individual words that are longer than @var{length}, these +will not be shortened. +@end defun + +@defun string-limit string length &optional end coding-system +If @var{string} is shorter than @var{length}, @var{string} is returned +as is. Otherwise, return a substring of @var{string} consisting of +the first @var{length} characters. If the optional @var{end} +parameter is given, return a string of the @var{length} last +characters instead. + +If @var{coding-system} is non-@code{nil}, @var{string} will be encoded +before limiting, and the result will be a unibyte string that's +shorter than @code{length}. If @var{string} contains characters that +are encoded into several bytes (for instance, when using +@code{utf-8}), the resulting unibyte string is never truncated in the +middle of a character representation. +@end defun + +@defun string-lines string &optional omit-nulls +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 start +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{start} is @code{nil} (or not present), the padding is done to the +end of the string, and if it's non-@code{nil}, to the start of the +string. +@end defun + +@defun string-chop-newline string +Remove the final newline, if any, from @var{string}. +@end defun + @node Modifying Strings @section Modifying Strings @cindex modifying strings |