add sources
This commit is contained in:
parent
fcd25eea52
commit
7ce631a648
21 changed files with 548 additions and 2 deletions
|
@ -0,0 +1,15 @@
|
|||
T[] find(T, E)(T[] haystack, E needle)
|
||||
if (is(typeof(haystack[0] != needle) == bool))
|
||||
{
|
||||
while (haystack.length > 0 && haystack[0] != needle)
|
||||
{
|
||||
haystack = haystack[1 .. $];
|
||||
}
|
||||
return haystack;
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
// assert(find([1, 2, 3], "Hello"));
|
||||
assert(find([1, 2, 3], 1.0));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue