DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(guile.info.gz) List/String Conversion

Info Catalog (guile.info.gz) String Constructors (guile.info.gz) Strings (guile.info.gz) String Selection
 
 21.4.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
  -- C Function: scm_string_to_list (str)
      Return a newly allocated list of the characters that make up the
      given string STR. `string->list' and `list->string' are inverses
      as far as `equal?' is concerned.
 
  -- Scheme Procedure: string-split str chr
  -- C Function: scm_string_split (str, chr)
      Split the string STR into the a list of the substrings delimited
      by appearances of the character CHR.  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 "" #\:)
           =>
           ("")
 
Info Catalog (guile.info.gz) String Constructors (guile.info.gz) Strings (guile.info.gz) String Selection
automatically generated byinfo2html