Reading unicode string with readf ("%s")

Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 3 12:10:01 PST 2014


On Monday, 3 November 2014 at 19:47:17 UTC, Ivan Kazmenko wrote:
> So, if there is an idiomatic way to read the whole file into a 
> string which is Unicode-compatible, it would be great to learn 
> that, too.

Maybe something like this:

import std.stdio;
import std.array;
import std.conv;

string text = stdin
	.byLine(KeepTerminator.yes)
	.join()
	.to!(string);


More information about the Digitalmars-d-learn mailing list