KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What is the simplest way to split arrays into multiple arrays based on some conditions? In my scenario, I need to move the integer and the string values to different arrays. I have tried split method, but does not work as expected. x=[1,2,3,"a","b",4] x.split {|item| item.kind_of? Fixnum} In C#, there is a group by option in Linq , which helps you group the objects based on the conditions. Is there a similar method on Object (not using activerecord) ? Is there a simple way?
Tags (comma-separated)
Save Edits
Cancel