6.61. kink/io/STR_PRINTER

6.61.1. STR_PRINTER.new(Newline)

`new` makes a `printer` which builds a string, with `Newline` used as Printer.newline.

The result `printer` also has `str` method. It returns a `str` val which joins strings passed to `print` method, and strings passed to `print_line` plus `newline`.

Precondition

`Newline` must be a `str`.

Example

:STR_PRINTER.require_from('kink/io/')

:P <- STR_PRINTER.new("\r\n")
P.print_line('foo')
P.print_line('bar')
stdout.print_line(P.str.repr) # => "foo\r\nbar\r\n"