Get a value from array

Hello.

I need to get a value from array.

For example:

h=[1234567,987654] # => 2 elements in array

I need to get a 3 to 6 digit from first element # => 3456
How i can do this?

On Nov 5, 2010, at 5:00 PM, Misha O. wrote:

Hello.

I need to get a value from array.

For example:

h=[1234567,987654] # => 2 elements in array

I need to get a 3 to 6 digit from first element # => 3456

h[0].to_s[2,4]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs