0
我有散列其鍵哈希值排序陣列
arr = [
{ :tap=> "bucket", :mobile=> "charger", :apple=> "knife", :gifted => "true" },
{ :tap=> "bucket", :mobile=> "charger", :apple=> "knife" },
{ :tap=> "bucket", :mobile=> "charger", :apple=> "knife" },
{ :tap=> "bucket", :mobile=> "charger", :apple=> "knife", :gifted => "true" }
]
我嘗試的基礎上,陣列哈希排序的數組:優=>「真」。這樣
sorted = [
{ :tap=> "bucket", :mobile=> "charger", :apple=> "knife", :gifted => "true" },
{ :tap=> "bucket", :mobile=> "charger", :apple=> "knife", :gifted => "true" }
{ :tap=> "bucket", :mobile=> "charger", :apple=> "knife" },
{ :tap=> "bucket", :mobile=> "charger", :apple=> "knife" }
]
感謝,這是聰明的... – Prem
你歡迎:) – aherve