Re: [Rails] Array value to get except first two values

2012-09-15 Thread Rob Biedenharn
And, of course, you can just you plain 'ol Ruby for this too: a = [1,2,3,4,5] a[2..-1] # => [3,4,5] %w[ a b c d e ][3..-1] #=> ['d', 'e'] -Rob On Sep 15, 2012, at 6:25 AM, Yong Gu wrote: > If you are using Rails, > > %w( a b c d ).from(0) # => %w( a b c d ) > %w( a b c d ).from(2) # => %w(

Re: [Rails] Array value to get except first two values

2012-09-15 Thread Yong Gu
If you are using Rails, %w( a b c d ).from(0) # => %w( a b c d ) %w( a b c d ).from(2) # => %w( c d ) %w( a b c d ).from(10) # => %w() %w().from(0) # => %w() On Sep 15, 2012, at 6:21 PM, Maddy wrote: > Hi folks, > > In an array value i need to find except first two values, > > exa

Re: [Rails] Array value to get except first two values

2012-09-15 Thread Jordon Bedwell
On Sat, Sep 15, 2012 at 9:33 AM, Hassan Schroeder wrote: > On Sat, Sep 15, 2012 at 3:21 AM, Maddy wrote: > >> In an array value i need to find except first two values, >> >> example: >> [1,2,3,4,5,6,7,8 ] >> >> in that i need to get values except [1,2]. >> >> How can i get it from this array?? >>

Re: [Rails] Array value to get except first two values

2012-09-15 Thread Hassan Schroeder
On Sat, Sep 15, 2012 at 3:21 AM, Maddy wrote: > In an array value i need to find except first two values, > > example: > [1,2,3,4,5,6,7,8 ] > > in that i need to get values except [1,2]. > > How can i get it from this array?? > > please advise Advisory #1: READ THE DOCS FOR ARRAY. Advisory

Re: [Rails] Array value to get except first two values

2012-09-15 Thread Иван Бишевац
[1,2,3,4,5,6,7,8 ][0..1] Look at documentation http://ruby-doc.org/core-1.9.3/Array.html#method-i-5B-5D. Generally good advice is to bookmark this page. 2012/9/15 Maddy > [1,2,3,4,5,6,7,8 ] -- You received this message because you are subscribed to the Googl

Re: [Rails] Array value to get except first two values

2012-09-15 Thread Carlos Mathiasen
[1,2,3,4].select{|n| ![1,2].include? n} :-) --- Send from my cellphone -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email t

[Rails] Array value to get except first two values

2012-09-15 Thread Maddy
Hi folks, In an array value i need to find except first two values, example: [1,2,3,4,5,6,7,8 ] in that i need to get values except [1,2]. How can i get it from this array?? please advise -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"