Adam Akhtar wrote:
> If i want to see if a list contains a particular word how would i go
> about doing so with letter case not being important. Normally two words
> spelt the same are not equal if they differ in case.
> 
> i.e. Shell != shell
> or   ShEll != shell
> 
> At first i thought simply conveting both the list and the word to search
> into uppercase thus making them the same but doing so would not be very
> efficient if the list is very big.
> 
> Any ideas??

data = ['ShEll', 'heLLO']

data.each do |word|
  if /shell/i =~ word
    puts 'found shell'
  end

  if /hello/i =~  word
    puts 'found hello'
  end
end

-- 
Posted via http://www.ruby-forum.com/.