O
O
Ord EO2020-08-22 13:38:22
ruby
Ord EO, 2020-08-22 13:38:22

How to find an element in an array with arrays in ruby?

I have an array with arrays like this:

arr = [
["<strong>some text</strong>",  23, "some value", "another value", "$6,656" ,"$8,146" ,"22.4%"],
["<italic>sfsdfdsf</italic>", "text", "text", "2134 dfdsf", "356", "$82,862","-5.1%"],
["gfdgdfsgdf", "EMPTY VALUE", "text", "djglkdfgj", "-$80,700", "-$74,716", "7.4%"],
["<strong>fdgsdffdsgfd</strong>", "tecx", "EMPTY VALUE", 123213, "7.6", 98, "2.2"]
]


How to check if an array contains arrat least one value"EMPTY VALUE"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-08-22
@OrdeO

arr.flatten.include?('EMPTY VALUE!')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question