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

FrankLike via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 8 04:54:47 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

You mean ? The result is not that I want to get!

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

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

void main()
{
     auto b = findAmong(ext,strs);
    	writeln("b is ",b);
}
---------result-----
b is ["exe","lib","a","dll"]
--------------------
note:
1. I only want to find the given string 'hello.exe' whether to 
include any a string in the ["exe","lib","a","dll"].
2. I think the 'indexOfAny' function of string.d do the same work 
with 'indexOf',This is not as it should be.

Frank


More information about the Digitalmars-d-learn mailing list