On Fri, 09 Jan 2015 12:46:53 +0000
FrankLike via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com>
wrote:

> The code is the best,and it's better than indexOfAny in C#:
> 
> import std.algorithm, std.stdio;
> void main ()
> {
>      auto places = [ "home", "office", "sea","plane"];
>      auto strWhere = "He is in the sea.";
>      auto where = places.canFind!(a => strWhere.canFind(a));
>      writeln("Result is  ",where);
> }
this does unnecessary upvalue access (`strWhere`). try to avoid such
stuff whenever it is possible.

Attachment: signature.asc
Description: PGP signature

Reply via email to