Why do the same work about 'IndexOfAny' and 'indexOf' function?

FrankLike via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 8 05:10:17 PST 2015


On Wednesday, 7 January 2015 at 17:08:55 UTC, H. S. Teoh via 
Digitalmars-d-learn wrote:
> Try this:
>
> 	http://dlang.org/phobos-prerelease/std_algorithm#.findAmong
>
>
> T

Thank you,it can work. but it's not what I want.

---------------test.d--------------
import  std.stdio, std.algorithm,std.string;

auto ext =["exe","lib","a","dll"];
auto strs = "hello.dll";

void main()
{
     auto b = findAmong(ext,strs);
    	writeln("b is ",b);
}
---------result-----
b is ["dll"]
--------------------

I think if  'indexOfAny' function of string.d do the work ,it 
should be ok.

such as :

  auto b = "hello.dll".indexOfAny(["exe","lib","a","dll"]);
    	writeln("b is ",b);

The result should be 'true',if it can work.

Can you suggest 'phobos' to update 'indexOfAny' fuction?

Thank you.
Frank


More information about the Digitalmars-d-learn mailing list