Strange behavior std.range.takeNone
Andrea Fontana via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Apr 7 01:49:57 PDT 2015
Yes it is.
takeNone() take a char from a string.
So you are going to append a char (with code 5) on the next line.
If you replace that line with:
s ~= 65;
it will print "A". (65 is ascii code for letter 'A')
On Tuesday, 7 April 2015 at 02:24:00 UTC, Dennis Ritchie wrote:
> Hi,
> Is it OK?
>
> -----
> import std.stdio : writeln;
> import std.range : takeNone;
>
> void main() {
>
> auto s = takeNone("test");
>
> s ~= 5;
>
> writeln(s); // prints ♣
> }
> -----
> Windows 8.1 x64, DMD 2.067.0
More information about the Digitalmars-d-learn
mailing list