From: Nick Bo Date: 2008-09-29T08:37:34+09:00 Subject: Re: Counting Tabs and splitting by that number Bill Kelly wrote: > From: "Nick Bo" >> >> eg = "abcdefg \t\t\t\t\t hi" >> eg.split("\t) --> ["abcdefg ", "", "", "", " i" >> eg.split("/\t+/) just gives me ["abcdefg \t\t\t\t\t i"] cause it dont >> matche the pattern given to the split at all so it makes whole thing >> part of the array. > > Huh? > >>> eg = "abcdefg \t\t\t\t\t hi" > => "abcdefg \t\t\t\t\t hi" >>> eg.split(/\t+/) > => ["abcdefg ", " hi"] > > > Regards, > > Bill it wouldnt give me the two, i so wish it did but i found a way around it this is my solution and it works perfect eg = "abcdefg \t\t\t\t\t\t hi" splitArray = eg.split("\t") splitArray = splitArray.delete("") loop arrayKey[i] = splitArray[0] arrayValue[i] = splitArray[1] Thanks for everyones help -- Posted via http://www.ruby-forum.com/.