[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
6.6.5.4 List/String conversion
When processing strings, it is often convenient to first convert them
into a list representation by using the procedure string->list
,
work with the resulting list, and then convert it back into a string.
These procedures are useful for similar tasks.
- Scheme Procedure: string->list str [start [end]]
- C Function: scm_substring_to_list (str, start, end)
- C Function: scm_string_to_list (str)
Convert the string str into a list of characters.
- Scheme Procedure: string-split str char_pred
- C Function: scm_string_split (str, char_pred)
Split the string str into a list of substrings delimited by appearances of characters that
- equal char_pred, if it is a character,
- satisfy the predicate char_pred, if it is a procedure,
- are in the set char_pred, if it is a character set.
Note that an empty substring between separator characters will result in an empty string in the result list.
(string-split "root:x:0:0:root:/root:/bin/bash" #\:) ⇒ ("root" "x" "0" "0" "root" "/root" "/bin/bash") (string-split "::" #\:) ⇒ ("" "" "") (string-split "" #\:) ⇒ ("")
This document was generated on April 20, 2013 using texi2html 5.0.