StrCmpLogicalW字符串逻辑比较函数
来源:互联网 发布:coreldraw绘制软件下载 编辑:程序博客网 时间:2024/06/06 12:32
今天在CSDN上看到有人讨论关于Windows资源管理器的排序方式规则,Windows是有这个API函数来解决这个事情的:StrCmpLogicalW。
Windows Vista、Windows XP 和 Windows Server 2003:
Windows 2000:
在本例中,401 在数值上大于 6。因此,在按照名称以升序对文件夹进行排序时,Ie401sp2 文件夹将在 Ie6 文件夹之后
列出。在下面的示例中,请注意名称中包含数字的以下文件的排序方式。
Windows Vista、Windows XP 和 Windows Server 2003:
StrCmpI认为字符串中的数字仅仅是一个文本,所以它的排序结果:
/*
Compares two Unicode strings. Digits in the strings are considered as numerical content rather than text. This test is not case sensitive.
Syntax
int StrCmpLogicalW( LPCWSTR psz1, LPCWSTR psz2);
Parameters
- psz1
- [in] A pointer to the first null-terminated string to be compared.
- psz2
- [in] A pointer to the second null-terminated string to be compared.
Return Value
- Returns zero if the strings are identical.
- Returns 1 if the string pointed to by psz1 has a greater value than that pointed to by psz2.
- Returns -1 if the string pointed to by psz1 has a lesser value than that pointed to by psz2.
*/
Windows Vista、Windows XP 和 Windows Server 2003 对名称中包含数字的文件和文件夹的排序顺序与 Windows 2000 中使用的排序顺序不同。
Windows Vista、Windows XP 和 Windows Server 2003:
Ie4_01
Ie4_128
Ie5
Ie6
Ie401sp2
Ie501sp2
Windows 2000:
Ie4_01
Ie4_128
Ie401sp2
Ie5
Ie501sp2
Ie6默认情况下,较新的排序顺序将文件和文件夹名称中的字符串视作数值内容而不是文本。文件夹和文件名称中的数字按照其数值大小进行排序。
在本例中,401 在数值上大于 6。因此,在按照名称以升序对文件夹进行排序时,Ie401sp2 文件夹将在 Ie6 文件夹之后
列出。在下面的示例中,请注意名称中包含数字的以下文件的排序方式。
Windows Vista、Windows XP 和 Windows Server 2003:
5.txt
11.txt
88.txtWindows 2000:
11.txt
5.txt
88.txt
注意StrCmpLogicalW与StrCmpI的区别:
StrCmpLogical认为字符串中的数字是其对应的数值,所以它的排序结果:
2string3string20stringst2ringst3ringst20ringstring2string3string20
20string2string3stringst20ringst2ringst3ringstring2string20string3
Over。
- StrCmpLogicalW字符串逻辑比较函数
- 字符串逻辑比较函数---StrCmpLogicalW的模拟实现
- 字符串逻辑比较函数---StrCmpLogicalW的模拟实现
- 字符串比较函数
- 字符串比较函数
- delphi 字符串比较函数
- 字符串Hash函数比较
- 字符串比较函数
- c 字符串比较函数
- php字符串比较函数
- php字符串比较函数
- javascript 字符串比较函数
- php--字符串比较函数
- 字符串比较函数strcmp
- 字符串比较函数总结
- 字符串比较函数收获
- 字符串比较函数
- DIY字符串比较函数
- 利用简单的自由布局实现实现下来列表式菜单
- Android OpenGL ES (1) -- 基础
- typedef和define具体的详细区别 2011.07.12
- 电脑改变人类大脑:上网时间多大脑灰质减少
- 惨痛教训
- StrCmpLogicalW字符串逻辑比较函数
- C#注册表编程示例二:在“新建”中添加自己的文件类型
- Date,String,Timestamp转化
- wait()
- Eclipse 浏览文件插件 EasyExplorer 和 OpenExplorer
- MYSQL数据库设计的一点总结
- Struts2 与 Ext 整合开发
- android自定义ListView背景
- HTML表单(Form)