Check if a String in a list exist?


how can i give an if/match condition an list of equals for an String.

if (thiskeycontains == oneStringofthisList)

I can check if an HashMap contains an key, but how can i check if an String contains an String of an Hashmap?

if (thiskeycontains == HashMap[key_01].contains(“oneStringofthisList”)) are strange

Give it an Iterator for some Variable-Typ that deliver this automaticly?

I want to check if an String from an Ini-File contains an setted Enviroment-Variable of the system.

Will this work ?

fn myfunc<'a>(mut strings: impl Iterator<Item=&'a str>, key: &'a str) -> bool {
        strings.any(|item| key.contains(item))

@prataprc Ah yeah cool that works.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.