endsWith: wrong function call, no error

monarch_dodra monarchdodra at gmail.com
Mon Oct 21 08:18:17 PDT 2013


On Monday, 21 October 2013 at 15:12:36 UTC, Chris wrote:
> 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?

It's a feature.


More information about the Digitalmars-d mailing list