Node:String Modification, Next:, Previous:String Selection, Up:Strings

21.4.6 String Modification

These procedures are for modifying strings in-place. This means that the result of the operation is not a new string; instead, the original string's memory representation is modified.

string-set! str k chr Scheme Procedure
scm_string_set_x (str, k, chr) C Function
Store chr in element k of str and return an unspecified value. k must be a valid index of str.

string-fill! str chr Scheme Procedure
scm_string_fill_x (str, chr) C Function
Store char in every element of the given string and return an unspecified value.

substring-fill! str start end fill Scheme Procedure
scm_substring_fill_x (str, start, end, fill) C Function
Change every character in str between start and end to fill.
(define y "abcdefg")
(substring-fill! y 1 3 #\r)
=> "arrdefg"

substring-move! str1 start1 end1 str2 start2 Scheme Procedure
scm_substring_move_x (str1, start1, end1, str2, start2) C Function
Copy the substring of str1 bounded by start1 and end1 into str2 beginning at position start2. str1 and str2 can be the same string.