Next: stdlib rfive compat, Previous: stdlib mutable pairs, Up: stdlib [Index]
The string-set!
procedure provided by the
(rnrs mutable-strings (6))
library allows mutating the characters of
a string in–place.
k must be a valid index of string.
The string-set!
procedure stores char in element k of
string and returns unspecified values.
Passing an immutable string to string-set!
should cause an
exception with condition type &assertion
to be raised.
(define (f) (make-string 3 #\*)) (define (g) "***") (string-set! (f) 0 #\?) ⇒ unspecified (string-set! (g) 0 #\?) ⇒ unspecified ; should raise exception &assertion (string-set! (symbol->string 'immutable) 0 #\?) ⇒ unspecified ; should raise exception &assertion
NOTE Implementors should make
string-set!
run in constant time.
Store char in every element of the given string. As Vicare extension: the return value is string itself.