aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/lispref/strings.texi28
1 files changed, 13 insertions, 15 deletions
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index 1d766869b1f..9436a96ead4 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -279,17 +279,26 @@ expression @var{separators} (@pxref{Regular Expressions}). Each match
279for @var{separators} defines a splitting point; the substrings between 279for @var{separators} defines a splitting point; the substrings between
280splitting points are made into a list, which is returned. 280splitting points are made into a list, which is returned.
281 281
282If @var{separators} is @code{nil} (or omitted), the default is the
283value of @code{split-string-default-separators} and the function
284behaves as if @var{omit-nulls} were @code{t}.
285
282If @var{omit-nulls} is @code{nil} (or omitted), the result contains 286If @var{omit-nulls} is @code{nil} (or omitted), the result contains
283null strings whenever there are two consecutive matches for 287null strings whenever there are two consecutive matches for
284@var{separators}, or a match is adjacent to the beginning or end of 288@var{separators}, or a match is adjacent to the beginning or end of
285@var{string}. If @var{omit-nulls} is @code{t}, these null strings are 289@var{string}. If @var{omit-nulls} is @code{t}, these null strings are
286omitted from the result. 290omitted from the result.
287 291
288If @var{separators} is @code{nil} (or omitted), the default is the 292If the optional argument @var{trim} is non-@code{nil}, it should be a
289value of @code{split-string-default-separators}. 293regular expression to match text to trim from the beginning and end of
294each substring. If trimming makes the substring empty, it is treated
295as null.
296
297If you need to split a string into a list of individual command-line
298arguments suitable for @code{call-process} or @code{start-process},
299see @ref{Shell Arguments, split-string-and-unquote}.
290 300
291As a special case, when @var{separators} is @code{nil} (or omitted), 301Examples:
292null strings are always omitted from the result. Thus:
293 302
294@example 303@example
295(split-string " two words ") 304(split-string " two words ")
@@ -306,8 +315,6 @@ useful. If you need such a result, use an explicit value for
306 @result{} ("" "two" "words" "") 315 @result{} ("" "two" "words" "")
307@end example 316@end example
308 317
309More examples:
310
311@example 318@example
312(split-string "Soup is good food" "o") 319(split-string "Soup is good food" "o")
313 @result{} ("S" "up is g" "" "d f" "" "d") 320 @result{} ("S" "up is g" "" "d f" "" "d")
@@ -354,15 +361,6 @@ practice:
354(split-string "ooo" "\\|o+" t) 361(split-string "ooo" "\\|o+" t)
355 @result{} ("o" "o" "o") 362 @result{} ("o" "o" "o")
356@end example 363@end example
357
358If the optional argument @var{trim} is non-@code{nil}, it should be a
359regular expression to match text to trim from the beginning and end of
360each substring. If trimming makes the substring empty, it is treated
361as null.
362
363If you need to split a string into a list of individual command-line
364arguments suitable for @code{call-process} or @code{start-process},
365see @ref{Shell Arguments, split-string-and-unquote}.
366@end defun 364@end defun
367 365
368@defvar split-string-default-separators 366@defvar split-string-default-separators