phobos/changelog/write-text.dd
Paul Backus b7395ea7f5
std.conv: add writeText, writeWText, writeDText (#10652)
* 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
2025-03-28 15:23:12 -07:00

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");
---