mirror of
https://github.com/dlang/phobos.git
synced 2025-04-26 13:10:35 +03:00

* std.conv: factor out writeTextImpl from textImpl * std.conv: add writeText, writeWText, writeDText These are variants of text, wtext, and dtext that write their output to an output range instead of returning a string. Fixes #10550 * Add changelog entry for writeText
20 lines
539 B
Text
20 lines
539 B
Text
Add `writeText`, `writeWText`, and `writeDText` to `std.conv`
|
|
|
|
These functions are variants of the existing `text`, `wtext`, and `dtext`
|
|
functions. Instead of returning a string, they write their output to an output
|
|
range.
|
|
|
|
Like `text`, `writeText` can accept an
|
|
$(LINK2 $(ROOT_DIR)spec/istring.html, interpolated expression sequence) as an
|
|
argument.
|
|
|
|
Example:
|
|
|
|
---
|
|
import std.conv : writeText;
|
|
import std.array : appender;
|
|
|
|
auto output = appender!string();
|
|
output.writeText(i"2 + 2 == $(2 + 2)");
|
|
assert(output.data == "2 + 2 == 4");
|
|
---
|