Read a unicode character from the terminal
Jacob Carlborg
doob at me.com
Sun Apr 1 05:00:18 PDT 2012
On 2012-04-01 01:17, Ali Çehreli wrote:
> On 03/31/2012 11:53 AM, Ali Çehreli wrote:
>
> > The solution is to use ranges when pulling Unicode characters out of
> > strings. std.stdin does not provide this yet, but it will eventually
> > happen (so I've heard :)).
>
> Here is a Unicode character range, which is unfortunately pretty
> inefficient because it relies on an exception that is thrown from
> isValidDchar! :p
Ok, what's the differences compared to the example in your first post:
void main()
{
string line = readln();
foreach (dchar c; line) {
writeln(c);
}
}
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list