ruby 1.9.3中包含:
include? other_str → true or false click to toggle source
Returns true if str contains the given string or character.
"hello".include? "lo" #=>true
"hello".include? "ol" #=>false
"hello".include? ?h #=>true
数组是
array = [[1],[2],[3],[0],[1,2],[1,0],[0,1]]
希望排序整个数组,先按照数组 元素个数 ,如果个数相同再 按照首个元素大小 。
array.sort_by {|a| [a.size, a[0]] }