189 8069 5689

VB.NET中怎么按文件名排序

本篇文章给大家分享的是有关VB.NET中怎么按文件名排序,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

创新互联公司专注于岚县网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供岚县营销型网站建设,岚县网站制作、岚县网页设计、岚县网站官网定制、微信平台小程序开发服务,打造岚县网络公司原创品牌,更为您提供岚县网站排名全网营销落地服务。

VB.NET文件名排序案例:

输入 : a1,a2,a10,a001 。我们知道,如果按照字符串比较,结果应该是 a001,a1,a10,a2,但我们期望的结果应该是a001,a1,a2,a10.

自己写了一个VB.NET文件名排序算法

VB.NET code /*  Return Value Description  < 0  arg1 less than arg2  0  arg1 equivalent to arg2  > 0  arg1 greater than arg2  */  int compare(const void* arg1,const void* arg2)  {  if (NULL==arg1||NULL==arg2)//address of item  return 0;  LPSTR lpText1 = *( TCHAR** )arg1; //content of item  LPSTR lpText2 = *( TCHAR** )arg2; //content of item  if (NULL==lpText1||NULL==lpText2)  return 0;  int nText1Len = _tcslen(lpText1);  int nText2Len = _tcslen(lpText2);  int nText1IndexHandled = 0;  int nText2IndexHandled = 0;  int nRet = 0;  for (;;)  {  if (nText1IndexHandled==nText1Len||nText2IndexHandled==nText2Len) //don't compare complete since all are same, "ab","abc"  {  TCHAR chOffset1 = nText1IndexHandled=0;--nPos)  lpFormatNum1[nIndex--]=lpNumber1[nPos];  nIndex = nMaxLen-1;  for (nPos=nNum2Len-1;nPos>=0;--nPos)  lpFormatNum2[nIndex--]=lpNumber2[nPos];  for (nPos=0;nPos

以上就是VB.NET中怎么按文件名排序,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注创新互联行业资讯频道。


文章题目:VB.NET中怎么按文件名排序
文章转载:http://cdxtjz.cn/article/jiohei.html

其他资讯