Finding position of a value in an array

Ron Tarrant rontarrant at gmail.com
Sun Dec 29 10:16:53 UTC 2019


On Sunday, 29 December 2019 at 09:44:18 UTC, MoonlightSentinel 
wrote:
> On Sunday, 29 December 2019 at 08:31:13 UTC, mipri wrote:
>> On Sunday, 29 December 2019 at 08:26:58 UTC, Daren Scot Wilson 
>> wrote:

>> int i = a.countUntil!(v => v == 55);
>> assert(i == 2);
>
> A predicate isn’t required, countUntil accepts single elements:
>
> int i = a.countUntil(55);

I was just about to go looking for something like this. Thanks, 
guys.


More information about the Digitalmars-d-learn mailing list