How to fetch out the “id” value from the following piece of code when I have a string for which I have to match with each value key by the substring matching.
for ex- String I have saasgasgasdaaaaacricketintelligento. Now, I want to match each value from the Value key, if present then return id key's value else nil.
I’m not quite sure I fully understand what you mean, but this should work to extract an id based on a partial match of the concatenated elements in the value list of each entry:
Because of the string concatenation involved it is not the most efficient solution, probably. I would recommend, however, to refactor your data structure into a map first, instead of a list of maps. Why not use something like %{"1" => ["intelligent", "software dev"]}?