string-fill!

Synopsis

(string-fill! string char)

Parameters

  • string
  • char

Description

string-fill! sets every character in string to char. string-fill! appears in the Revised5 Report but not in the ANSI/IEEE standard.

Side Effects

Return Value

unspecified

Implementation

(define string-fill!
 (lambda (s c)
   (let ((n (string-length s)))
     (do ((i 0 (+ i 1)))
         ((= i n))
         (string-set! s i c)))))

Example

> (let ((str (string-copy "sleepy")))
 (string-fill! str #\Z)
 str)
"ZZZZZZ"
>