Syntax for checking if an element exists in a list

Tobias Pankrath via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 5 04:35:02 PST 2015


import std.algorithm;

int main(string[] options)
{
         // true if the first option given to this program is 
either foo, bar, or baz.
         if(options[1].canFind("foo", "bar", "baz"))
                 return 0;
         return 1;
}


More information about the Digitalmars-d-learn mailing list