AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 
This Site
 Search Engine
 Contact Form
 

Donate to AllAPI.net

CompareString

The CompareString function compares two character strings, using the locale specified by the given identifier as the basis for the comparison.

VB4-32,5,6
Declare Function CompareString Lib "kernel32" Alias "CompareStringA" (ByVal Locale As Long, ByVal dwCmpFlags As Long, ByVal lpString1 As String, ByVal cchCount1 As Long, ByVal lpString2 As String, ByVal cchCount2 As Long) As Long

VB.NET
System.String.Compare

Operating Systems Supported
Requires Windows NT 3.1 or later; Requires Windows 95 or later

Library
Kernel32

Parameter Information
∑ Locale
Specifies the locale used for the comparison. This parameter can be one of the following predefined locale identifiers:
LOCALE_SYSTEM_DEFAULT
The systemís default locale.
LOCALE_USER_DEFAULT
The current userís default locale.
This parameter can also be a locale identifier created by the MAKELCID macro.

∑ dwCmpFlags
A set of flags that indicate how the function compares the two strings. By default, these flags are not set. This parameter can specify zero to get the default behavior, or it can be any combination of the following values:
NORM_IGNORECASE
Ignore case.
NORM_IGNOREKANATYPE
Do not differentiate between Hiragana and Katakana characters. Corresponding Hiragana and Katakana characters compare as equal.
NORM_IGNORENONSPACE
Ignore nonspacing characters.
NORM_IGNORESYMBOLS
Ignore symbols.
NORM_IGNOREWIDTH
Do not differentiate between a single-byte character and the same character as a double-byte character.
SORT_STRINGSORT
Treat punctuation the same as symbols.

∑ lpString1
Points to the first string to be compared.

∑ cchCount1
Specifies the size, in bytes (ANSI version) or characters (Unicode version), of the string pointed to by the lpString1 parameter. If this parameter is - 1, the string is assumed to be null terminated and the length is calculated automatically.

∑ lpString2
Points to the second string to be compared.

∑ cchCount2
Specifies the size, in bytes (ANSI version) or characters (Unicode version), of the string pointed to by the lpString2 parameter. If this parameter is - 1, the string is assumed to be null terminated and the length is calculated automatically.

Return Values
If the function succeeds, the return value is one of the following values:
CSTR_LESS_THAN
The string pointed to by the lpString1 parameter is less in lexical value than the string pointed to by the lpString2 parameter.

CSTR_EQUAL
The string pointed to by lpString1 is equal in lexical value to the string pointed to by lpString2.

CSTR_GREATER_THAN
The string pointed to by lpString1 is greater in lexical value than the string pointed to by lpString2.



If the function fails, the return value is zero. To get extended error information, call GetLastError. GetLastError may return one of the following error codes: ERROR_INVALID_FLAGS

ERROR_INVALID_PARAMETER

Examples

Related Functions

No VB.NET Example Found

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at http://allapi.mentalis.org/