C
Chris Chris
Hi,
I have an array a
=> [["abc", "def", "ghi|ghi|kl"], ["jkl", "mno", "ghi|pqr"], ["stu",
"vwx", "yz|abc"]]
Some strings contain the pipe character.
I want to delete all the arrows that do NOT contain a certain string.
I tried this:
a.delete_if { |x| !x.include? "ghi|ghi" }
=> []
Of course, the array I need would be
=> [["abc", "def", "ghi|ghi|kl"]]
I couldn't figure out a work around. Any wildcards available for string
checking in Ruby? Any ideas?
Thanks.
Cheers,
Chris
I have an array a
=> [["abc", "def", "ghi|ghi|kl"], ["jkl", "mno", "ghi|pqr"], ["stu",
"vwx", "yz|abc"]]
Some strings contain the pipe character.
I want to delete all the arrows that do NOT contain a certain string.
I tried this:
a.delete_if { |x| !x.include? "ghi|ghi" }
=> []
Of course, the array I need would be
=> [["abc", "def", "ghi|ghi|kl"]]
I couldn't figure out a work around. Any wildcards available for string
checking in Ruby? Any ideas?
Thanks.
Cheers,
Chris