| string-fill!(3scm) | Scheme Programmer's Manual | string-fill!(3scm) |
NAME
string-fill! - fill a string with a character
LIBRARY
(import (rnrs mutable-strings)) ;R6RS (import (scheme r5rs)) ;R7RS (import (scheme base)) ;R7RS
SYNOPSIS
(string-fill! string char) (string-fill! string char start) ;R7RS (string-fill! string char start end) ;R7RS
DESCRIPTION
Stores char in every element of string.
- R7RS
- Only modifies string between start (inclusive) and end (exclusive). If omitted, start defaults to 0 and end defaults to the length of string.
RETURN VALUES
EXAMPLES
;; R7RS example (let ((s (make-string 4 #\x))) (string-fill! s #\y 2) s) => "xxyy"
APPLICATION USAGE
This procedure is used to fill strings that have already been created. It has marginal utility. The second argument to make-string(3scm) fills the entire string at creation time.
COMPATIBILITY
The start and end arguments are unique to R7RS.
ERRORS
This procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
- The wrong number of arguments was passed or an argument was outside its domain.
- R7RS
- The assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.
- Unsupported characters (R7RS)
- It is an error to fill with a character which the implementation does not support. 7-bit ASCII (except #\null) must be supported. Any other character is optional and potentially an error (as described above). You can use the full-unicode feature identifier in cond-expand(3scm) to check if all of Unicode 6.0 is supported.
SEE ALSO
make-string(3scm), string-set!(3scm)
STANDARDS
R4RS, R5RS, R6RS, R7RS
HISTORY
The first Scheme report to carry this procedure was R2RS, which also had substring-fill! that filled a substring, but used a different argument order: (substring-fill! string start end char). It is missing from IEEE Scheme.
AUTHORS
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://weinholt.se/scheme/manpages/.
| 2022-05-14 |