Перенос страниц
This commit is contained in:
parent
4d57446057
commit
4c954c9186
129 changed files with 14 additions and 15 deletions
|
@ -0,0 +1,20 @@
|
|||
T1[] find(T1, T2)(T1[] longer, T2[] shorter)
|
||||
if (is(typeof(longer[0 .. 1] == shorter) : bool))
|
||||
{
|
||||
while (longer.length >= shorter.length)
|
||||
{
|
||||
if (longer[0 .. shorter.length] == shorter)
|
||||
{
|
||||
break;
|
||||
}
|
||||
longer = longer[1 .. $];
|
||||
}
|
||||
return longer;
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
double[] d1 = [ 6.0, 1.5, 2.25, 3 ];
|
||||
float[] d2 = [ 1.5, 2.25 ];
|
||||
assert(find(d1, d2) == d1[1 .. $]);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue