Re: startsWith

2023-09-30 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 1 October 2023 at 05:33:36 UTC, Joel wrote: ```d void main() { import std.string : split; import std.algorithm.searching : startsWith; string bk="Exo"; assert(("Gen Exo Lev Num Deu Jos Judg Rut 1Sam 2Sam".split~ "1Kin 2Kin 1Chr 2Chr Ezra Neh Est Job Psa Pr

Re: startsWith using an array of needles

2013-08-20 Thread H. S. Teoh
On Tue, Aug 20, 2013 at 03:16:28PM -0400, Jonathan M Davis wrote: > On Tuesday, August 20, 2013 19:14:08 Byron wrote: > > On Tuesday, 20 August 2013 at 16:51:35 UTC, Jonathan M Davis > > > > wrote: > > > On Tuesday, August 20, 2013 17:58:19 Byron wrote: > > >> I am trying to use startsWith with an

Re: startsWith using an array of needles

2013-08-20 Thread Jonathan M Davis
On Tuesday, August 20, 2013 19:32:57 bearophile wrote: > Jonathan M Davis: > > startsWith dosen't take an array of needles. It takes a > > variadic list of them. > > All the argument after the first of startsWith could be required > to be of the same type, for this D offers: > > void foo(T)(T[] i

Re: startsWith using an array of needles

2013-08-20 Thread Jonathan M Davis
On Tuesday, August 20, 2013 19:14:08 Byron wrote: > On Tuesday, 20 August 2013 at 16:51:35 UTC, Jonathan M Davis > > wrote: > > On Tuesday, August 20, 2013 17:58:19 Byron wrote: > >> I am trying to use startsWith with an array of needles. Failes > >> with not being able to match any functions. Not

Re: startsWith using an array of needles

2013-08-20 Thread Jonathan M Davis
On Tuesday, August 20, 2013 19:14:08 Byron wrote: > On Tuesday, 20 August 2013 at 16:51:35 UTC, Jonathan M Davis > > wrote: > > On Tuesday, August 20, 2013 17:58:19 Byron wrote: > >> I am trying to use startsWith with an array of needles. Failes > >> with not being able to match any functions. Not

Re: startsWith using an array of needles

2013-08-20 Thread bearophile
Jonathan M Davis: startsWith dosen't take an array of needles. It takes a variadic list of them. All the argument after the first of startsWith could be required to be of the same type, for this D offers: void foo(T)(T[] items...) {} void main() { foo(1); foo(1, 2); foo(1, 2, 3)

Re: startsWith using an array of needles

2013-08-20 Thread Byron
On Tuesday, 20 August 2013 at 16:51:35 UTC, Jonathan M Davis wrote: On Tuesday, August 20, 2013 17:58:19 Byron wrote: I am trying to use startsWith with an array of needles. Failes with not being able to match any functions. Not sure if there is a work around. const auto ignore = [".git/", ".

Re: startsWith using an array of needles

2013-08-20 Thread Jonathan M Davis
On Tuesday, August 20, 2013 17:58:19 Byron wrote: > I am trying to use startsWith with an array of needles. Failes > with not being able to match any functions. Not sure if there is > a work around. > > const auto ignore = [".git/", ".gitignore"]; > > foreach(DirEntry e; getcwd.dirEntries(SpanMod