How to use the Among method with a string array
Andrew Chapman via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Sep 16 11:18:45 UTC 2017
Hi all, sorry for the very simple question, but I'm looking at
the "among" function in std.comparison:
https://dlang.org/phobos/std_algorithm_comparison.html#among
If I have a string array:
string[] fruit = ["apple", "pear", "strawberry"];
How do I use "among" to see if "apple" is present. E.g. I want
to do this:
if ("apple".among(fruit))
However that wont compile - I'm missing something fundamental in
my knowledge.
It seems fruit has to be a Tuple? Is there a way to use a string
array instead?
More information about the Digitalmars-d-learn
mailing list