diff options
author | Daniel Hartwig <mandyke@gmail.com> | 2012-10-08 18:35:00 +0800 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2012-10-12 08:15:08 -0400 |
commit | 5f085775aba737c6e829b3e06abb66a64c83b057 (patch) | |
tree | be5b9ffd86dfeba68371e37133a9061ad9ff8340 /doc/ref/api-data.texi | |
parent | 8b22ced1c9dee2743eedb5658172e931a42e8453 (diff) | |
download | guile-5f085775aba737c6e829b3e06abb66a64c83b057.tar.gz |
In string-split, add support for character sets and predicates.
* libguile/srfi-13.c (string-split): Add support for splitting on
character sets and predicates, like string-index and others.
* test-suite/tests/strings.test (string-split): Add tests covering
the new argument types.
* doc/ref/api-data.texi (string-split): Update.
Signed-off-by: Mark H Weaver <mhw@netris.org>
Diffstat (limited to 'doc/ref/api-data.texi')
-rw-r--r-- | doc/ref/api-data.texi | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi index 39c97909a..6d8de2bd6 100644 --- a/doc/ref/api-data.texi +++ b/doc/ref/api-data.texi @@ -3152,12 +3152,24 @@ These procedures are useful for similar tasks. Convert the string @var{str} into a list of characters. @end deffn -@deffn {Scheme Procedure} string-split str chr -@deffnx {C Function} scm_string_split (str, chr) +@deffn {Scheme Procedure} string-split str char_pred +@deffnx {C Function} scm_string_split (str, char_pred) Split the string @var{str} into a list of substrings delimited -by appearances of the character @var{chr}. Note that an empty substring -between separator characters will result in an empty string in the -result list. +by appearances of characters that + +@itemize @bullet +@item +equal @var{char_pred}, if it is a character, + +@item +satisfy the predicate @var{char_pred}, if it is a procedure, + +@item +are in the set @var{char_pred}, if it is a character set. +@end itemize + +Note that an empty substring between separator characters will result in +an empty string in the result list. @lisp (string-split "root:x:0:0:root:/root:/bin/bash" #\:) |