我從文件夾中讀取所有文件的順序有問題。vb.net從文件夾中讀取所有文件的順序
我的代碼讀取文件與錯誤的順序 時,我有文件: 的1.txt 2.txt 10.txt 20.txt 100.txt
我的代碼讀取文件看的第一個字母文件: 的1.txt 10.txt 100.txt 2.txt 20.txt
我怎麼能讀取數值順序文件? 的1.txt 2.txt 10.txt 20.txt 100.txt
我使用的代碼的下面:
Dim di As New DirectoryInfo(Path), fiArr As FileInfo() = di.GetFiles()
Dim strplik As FileInfo
For Each strplik In fiArr
'read strplik from file
next strplik
那些不是數字,他們正在測試,所以'9.txt'將會比'1000.txt'更高。您需要使用自然排序對結果進行排序[例如這裏的一個](http://stackoverflow.com/a/33786276/1070452)另請閱讀[問]並參加[遊覽] – Plutonix
這裏有一個幾乎相同的問題https://stackoverflow.com/q/12907499/5162073 –
所以有沒有排序文件名稱的任何方法? – JakubM