manpagez: man pages & more
info guile
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.6.5.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.

Scheme Procedure: string-set! str k chr
C Function: scm_string_set_x (str, k, chr)

Store chr in element k of str and return an unspecified value. k must be a valid index of str.

C Function: void scm_c_string_set_x (SCM str, size_t k, SCM chr)

Like scm_string_set_x, but the index is given as a size_t.

Scheme Procedure: string-fill! str chr [start [end]]
C Function: scm_substring_fill_x (str, chr, start, end)
C Function: scm_string_fill_x (str, chr)

Stores chr in every element of the given str and returns an unspecified value.

Scheme Procedure: substring-fill! str start end fill
C Function: scm_substring_fill_x (str, start, end, fill)

Change every character in str between start and end to fill.

(define y (string-copy "abcdefg"))
(substring-fill! y 1 3 #\r)
y
⇒ "arrdefg"
Scheme Procedure: substring-move! str1 start1 end1 str2 start2
C Function: scm_substring_move_x (str1, start1, end1, str2, start2)

Copy the substring of str1 bounded by start1 and end1 into str2 beginning at position start2. str1 and str2 can be the same string.

Scheme Procedure: string-copy! target tstart s [start [end]]
C Function: scm_string_copy_x (target, tstart, s, start, end)

Copy the sequence of characters from index range [start, end) in string s to string target, beginning at index tstart. The characters are copied left-to-right or right-to-left as needed – the copy is guaranteed to work, even if target and s are the same string. It is an error if the copy operation runs off the end of the target string.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 20, 2013 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.