From: Ne Scripter Date: 2009-10-12T22:18:24+09:00 Subject: Re: Spliting hash using map! Sorry for being unclear. Basically, if I say the following string = "0002 0003 0004 0005" if 0002.match(/#{string}/) puts string end So I want to say if my string contains the item given in the IF statement tell me the item that it found, in the example above 0002. The code I have above does not match anything. Thanks angico wrote: > Hi, > > ------ > On Monday 12 October 2009 07:14:57 Ne Scripter wrote: > >> individual items, I use map! (output = ID.map!{|str| str.split(/\s+/) >> }.flatten!) to do this giving >> >> 0001 >> 000200030004 >> 00050006 >> > > If you are to put the result of map in 'output' the you don't need map!, > just > map. You also don't need flatten!, just flatten. > > And, BTW, where does ID come from? What is ID, an array, a string? > > -- > angico > ------ > > Site: angico.org > Blog: angico.org/blog > > Gnu/Linux, FLOSS, Espiritismo, e eu por mim mesmo 8^I > > == Coopera巽達o 辿 _muito_ melhor que competi巽達o == -- Posted via http://www.ruby-forum.com/.