The lstrcmp function compares two character strings. The comparison is case sensitive.
int lstrcmp(
LPCTSTR lpString1, |
// address of first string |
LPCTSTR lpString2 |
// address of second string |
); |
If the string pointed to by lpString1 is less than the string pointed to by lpString2, the return value is negative. If the string pointed to by lpString1 is greater than the string pointed to by lpString2, the return value is positive. If the strings are equal, the return value is zero.
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.
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 (locale) selected by the user at setup time, or via the control panel, determines which string is greater (or whether the strings are the same). If no language (locale) is selected, Windows performs the comparison by using default values.
With a double-byte character set (DBCS) version of Windows, this function can compare two DBCS strings.
The Win32 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. Note that in 16-bit versions of Windows, lstrcmp uses a string sort. For a detailed discussion of word sorts and string sorts, see the Remarks section of the reference page for the CompareString function .
CompareString, lstrcat, lstrcmpi, lstrcpy, lstrlen
file: /Techref/os/win/api/win32/func/src/f55_21.htm, 3KB, , updated: 2000/4/7 11:19, local time: 2024/11/4 22:59,
13.58.52.94:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://linistepper.com/techref/os/win/api/win32/func/src/f55_21.htm"> lstrcmp</A> |
Did you find what you needed? |