The Case Against Autodecode
jmh530 via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jun 2 13:23:40 PDT 2016
On Thursday, 2 June 2016 at 20:01:54 UTC, Timon Gehr wrote:
>
> Doesn't work. Shouldn't compile. (char and wchar shouldn't be
> comparable.)
>
In Andrei's original post, he says that s is a string variable.
He doesn't say it's a char. I find the weirder thing to be that t
below is false, per deadalnix's point.
import std.algorithm : all;
import std.stdio : writeln;
void main()
{
string s = "ö";
auto t = s.all!(c => c == 'ö');
writeln(t); //prints false
}
I could imagine getting frustrated that something like the code
below throws errors.
import std.algorithm : all;
import std.stdio : writeln;
void main()
{
import std.uni : byGrapheme;
string s = "ö";
auto s2 = s.byGrapheme;
auto t2 = s2.all!(c => c == 'ö');
writeln(t2);
}
More information about the Digitalmars-d
mailing list