Function write-string, write-line

Syntax:

write-string string &optional output-stream &key start end string

write-line string &optional output-stream &key start end string

Arguments and Values:

string—a string.

output-stream—an output stream designator. The default is standard output.

start, endbounding index designators of string. The defaults for start and end are 0 and nil, respectively.

Description:

22.3.1 13write-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.

Redundant with "bounded by" above. -kmp 23-Jan-92 \param{start} specifies the offset into \param{string}. \param{end} marks the the position following the last element of the substring.

22.3.1 16 this paragraph was left out

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:

*standard-output*, *terminal-io*.

Exceptional Situations:

None.

See Also:

read-line, write-char

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))
The WRITE-LINE equivalence supplied by Barmar.