From: "Ian M. Asaff" Date: 2010-12-29T08:43:58+09:00 Subject: Re: convert String "1;2;3;4;5;" to Array --0016e6de04219cbf4b049881067b Content-Type: text/plain; charset=ISO-8859-1 Yep. --sent from myu droid. typoos courtesy of droid's crappy keyboarsd On Dec 28, 2010 6:41 PM, "Thomas T." wrote: > Ian M. Asaff wrote in post #971169: >> you mean something like this? >> "1;2;3;4;5;6;7;8;9;10".split(';').inject([]) { |a,i| a << i.to_i } >> => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] > > Ok, I've read the page on .inject, but do have a question on your > solution. I'm interested in the [] where I read an initial value may be > supplied in .inject([]). Is the [] initializing an empty array to which > the accumulator, a, will populate? > > -- > Posted via http://www.ruby-forum.com/. > --0016e6de04219cbf4b049881067b--