看板 Programming 關於我們 聯絡資訊
比如說,我有一串檔名: 1.jpg 2.jpg .... 11.jpg 12.jpg 在視窗的資料夾中就會以 1.jpg 2.jpg .... 11.jpg 12.jpg 排列 但是用字串排序就會變成 1.jpg 11.jpg 12.jpg ... 2.jpg 要是事前完全不知道會遇到怎樣的檔名 要如何讓程式分析出檔名中的數字來排列? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 128.125.4.171
nedbob:將字串中的數字(字串)轉成數字(數字)再去排 59.115.73.178 10/17 12:32
nedbob:不然就是用先比 "字數" 再比較字串 59.115.73.178 10/17 12:33
nedbob:字數越多越後面 同字數再直接字串排序 59.115.73.178 10/17 12:34
buganini:nature sort 221.169.71.109 10/17 13:15
caml:dictionary sort219.142.118.227 10/17 16:58