Hi --

On Thu, 13 Oct 2005, Peter v. N. wrote:

> Hi all,
>
> Once again I disturb you for a, maybe, obvious thing
> I can't figure out.
>
> I have successfully created an md array (see older posts
> from me) thanks to the support found here.
>
> Now I would like to list all String items in the source array
> (a Text file containing numbers) and convert and place them into the 
> destination array as int objs. I know about the String#split method but this 
> recreates an array that does not match the dimensions I want
> (e.g. lines with different length).
>
> My approach is very c-ish:
>
> <code>
> # @source is a String array. If the string contains a non-convertible
> # substring, 0 is placed in destination array. @array is the destination # md 
> array created with the appropriate dimensions according to @source # (longest 
> line as vindex (-) and index as hindex (|) )
>
> for i in 0... / hindex.length
> 	for j in 0...@vindex[i].length
> 		@array[i][j] = @source[i][j].to_i.char.to_i
> 	end
> end
> </code>
>
> Is there a Ruby way to replace <code> with blocks?

I'm not quite sure what's what here.  I thought @vindex was the length
of the longest string, but then what's @vindex[i]?

Also, what would constitute a non-convertible substring?

Can you clarify, or maybe provide a small example of desired
input/output?


David

-- 
David A. Black
dblack / wobblini.net