endsWith: wrong function call, no error

Chris wendlec at tcd.ie
Mon Oct 21 08:12:35 PDT 2013


The following code compiles:

import std.stdio;

void main() {

	auto text = "Hello world!";
	if (!std.algorithm.endsWith(text, "!" ".")) {
		writeln("No punctuation!");
	} else {
		writeln("Has punctuation");
	}
}

The bug is in line 6 a missing comma between "!" and ".":

!std.algorithm.endsWith(text, "!" ".")

If you insert the comma, it will behave as expected.

Is this ok or a bug?


More information about the Digitalmars-d mailing list