Kernel32CompareStringOrdinal(IntPtr, Int32, IntPtr, Int32, Boolean) Method

Compares two Unicode strings to test binary equivalence.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", SetLastError = true)]
public static int CompareStringOrdinal(
	IntPtr string1,
	int length1,
	IntPtr string2,
	int length2,
	bool ignoreCase
)

Parameters

string1  IntPtr
The first string to compare.
length1  Int32
Character length of the string indicated by string1 parameter.

If this value is '-1', the function determines the length automatically.

string2  IntPtr
The second string to compare.
length2  Int32
Character length of the string indicated by string2 parameter.

If this value is '-1', the function determines the length automatically.

ignoreCase  Boolean
True: performs a case-insensitive comparison.

False: performs a case-sensitive comparison.

Return Value

Int32
Returns one of the following values if successful:

1 (CSTR_LESS_THAN): string1 is less than string2.

2 (CSTR_EQUAL): string1 is equals to string2.

3 (CSTR_GREATER_THAN): string1 is greater than string2.

If the function fails, the return value is zero.

To get extended error information, call GetLastWin32Error.

Remarks

See Also