User Tools


Function WRITE-STRING, WRITE-LINE

Syntax

  • write-string string &optional output-stream &key start endstring
  • write-line string &optional output-stream &key start endstring

Arguments and Values

Description

write-string writes the characters of the subsequence of string bounded by start and end to output-stream. write-line does the same thing, but then outputs a newline afterwards.

Examples

(prog1 (write-string "books" nil :end 4) (write-string "worms"))

bookworms

"books"

(progn (write-char #\*) (write-line "test12" *standard-output* :end 5) (write-line "*test2") (write-char #\*) nil)

*test1 *test2 *

NIL

Side Effects

None.

Affected By

Exceptional Situations

None.

See Also

Notes

write-line and write-string return string, not the substring bounded by start and end.

(write-string string) ≡ (dotimes (i (length string)) (write-char (char string i))) (write-line string) ≡ (prog1 (write-string string) (terpri))

\issue{SUBSEQ-OUT-OF-BOUNDS} \issue{RANGE-OF-START-AND-END-PARAMETERS:INTEGER-AND-INTEGER-NIL} \issue{READ-AND-WRITE-BYTES:NEW-FUNCTIONS}