From: "AMILIN Aurélien" Date: 2010-04-07T01:49:04+09:00 Subject: Re: Parse the data in an array index in ruby I don't know what exactly is in @data so I may be wrong, but you could try something like this : class MyClass def initialize(data) @data = data end def split(regexp = /\s+/) @data.collect { |e| e.split(regexp) } end end arr = ['ABC DEF GHI J KLMN OPQRS', 'TUV WX Y Z'] c = MyClass.new(arr) c.split # returns : [["ABC", "DEF", "GHI", "J", "KLMN", "OPQRS"], ["TUV", "WX", "Y", "Z"]] Le 06/04/2010 18:32, Brk Anl a écrit : > Hi, > > I have a array in a class. And i want to parse the data in the array's > index. > I tried split method but it said private method 'split'... > > For example > > class AA > > @data... > ........ > end > @data[0]=" ABC HGD KKK 111.." sth like that i need the datas seperately > like ABC > How can i do this? > -- Aurélien AMILIN