On Fri, 09 Jan 2015 12:46:53 +0000 FrankLike via Digitalmars-d-learn <[email protected]> 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.
signature.asc
Description: PGP signature
