0
陣列我有以下陣列如何紅寶石
arr = ["2014-05-02T19-49-55_1280x720_vga2usb.mp4", "2014-05-02T19-49-55_544x288_left_cam.mp4", "2014-05-02T19-49-55_544x288_right_cam.mp4", "2014-05-02T19-49-55_1632x288.mp4"]
我需要排序這個數組的方式,我得到以下排序:
["2014-05-02T19-49-55_1632x288.mp4", "2014-05-02T19-49-55_544x288_left_cam.mp4", "2014-05-02T19-49-55_544x288_right_cam.mp4", "2014-05-02T19-49-55_1280x720_vga2usb.mp4"]
我試圖用某種方法arr.sort
和arr.sort_by{|word| word.downcase}
但它給我輸出
["2014-05-02T19-49-55_1280x720_vga2usb.mp4", "2014-05-02T19-49-55_1632x288.mp4", "2014-05-02T19-49-55_544x288_left_cam.mp4", "2014-05-02T19-49-55_544x288_right_cam.mp4"]
我怎樣才能 做這個?
莫非如果答案幫助你,請關閉問題。 – kasi