From: dblack@... Date: 2006-08-24T04:55:11+09:00 Subject: Re: regexp or not Hi -- On Thu, 24 Aug 2006, Josselin wrote: > I am not yet a big friend of reegxp.. and I don't actually know if I should > use it or any other function > but I'd like to know the easiest path to do the following : > > I get a string person = 'Clara Mint" which is a full name > and I would like to find the object "id" in a collection using this full > name : > > people = [ ["id" => "1", "first" => "Jack", "last" => "Johnson"], ["id" => > "2", "first" => "Ben", "last" => "Kenneth"], ["id" => "3", "first" => "Ken", > "last" => "Olsen"], ["id" => "4", "first" => "Howard", "last" => "Wong"], > ["id" => "5", "first" => "Clara", "last" => "Mint"], ["id" => "7", "first" => > "Che", "last" => "Guevara"]] > > any hint to start ? I'm wondering whether your data structure is what you want. Right now you've got an array of arrays of hashes. Are you sure you don't just want an array of hashes? David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy ----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <----- http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log http://www.manning.com/black => book, Ruby for Rails http://www.rubycentral.org => Ruby Central, Inc.