lstrcmp: 按系统语言设置 对字符串排序
The lstrcmp function compares two strings by checking the first characters against each other, the second characters against each other, and so on until it finds an inequality or reaches the ends of the strings.
Note that the lpString1 and lpString2 parameters must be null terminated, otherwise the string comparison can be incorrect.
The function returns the difference of the values of the first unequal characters it encounters. For example, lstrcmp determines that "abcz" is greater than "abcdefg" and returns the difference of z and d.
The language (user locale) selected by the user at setup time, or through Control Panel, determines which string is greater (or whether the strings are the same). If no language (user locale) is selected, the system performs the comparison by using default values.
With a double-byte character set (DBCS) version of the system, this function can compare two DBCS strings.
The lstrcmp function uses a word sort, rather than a string sort. A word sort treats hyphens and apostrophes differently than it treats other symbols that are not alphanumeric, in order to ensure that words such as "coop" and "co-op" stay together within a sorted list. For a detailed discussion of word sorts and string sorts, see the Remarks section for the CompareString function.
本文详细介绍了lstrcmp函数的功能和使用方法。此函数用于比较两个字符串,并根据系统语言设置确定其大小顺序。文章还强调了参数必须以null终止的重要性,以及在不同字符集环境下该函数的表现。
510

被折叠的 条评论
为什么被折叠?



